This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 'imp' documentation does not mention that lock is re-entrant
Type: Stage:
Components: Documentation Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, djmitche
Priority: normal Keywords: patch

Created on 2007-01-01 00:22 by djmitche, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
1625509.patch djmitche, 2008-05-10 17:42 1625509.patch
Messages (3)
msg61049 - (view) Author: Dustin J. Mitchell (djmitche) * Date: 2007-01-01 00:22
My reading of import.c shows that imp.{acquire,release}_lock operate in the fashion of a threading.RLock, rather than a threading.Lock.  Of course, this makes sense for the use to which it's put, but it would be great to have that mentioned explicitly in the documentation.  Suggestion (stolen from threading documentation):

acquire_lock()
Acquires the interpreter's import lock for the current thread. This lock should be used by import hooks to ensure thread-safety when importing modules. 

Once a thread has acquired the import lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it.

On platforms without threads, this function does nothing. New in version 2.3.
msg66543 - (view) Author: Dustin J. Mitchell (djmitche) * Date: 2008-05-10 17:42
Patch attached.
msg66545 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-05-10 17:49
Applied to trunk to r62996.
History
Date User Action Args
2022-04-11 14:56:21adminsetgithub: 44390
2008-05-10 17:49:14akuchlingsetstatus: open -> closed
assignee: akuchling
resolution: accepted
messages: + msg66545
nosy: + akuchling
2008-05-10 17:42:31djmitchesetfiles: + 1625509.patch
keywords: + patch
messages: + msg66543
2007-01-01 00:22:20djmitchecreate