[Python-checkins] r61029 - python/trunk/Doc/library/thread.rst python/trunk/Doc/library/threading.rst

Christian Heimes lists at cheimes.de
Sun Feb 24 15:31:22 CET 2008


Nick Coghlan wrote:
> If we have C code doing unsafe imports we have to fix the C code, not 
> warn everybody off from doing imports outside the main thread. Similarly 
> if there are crashers at interpreter shutdown.

I implemented PyImport_ImportModuleNoBlock() to have safe imports in C
code. The function tries to grap the module from sys.modules first
without grabbing the import lock. If the module wasn't loaded before it
uses the standard import modules *unless* a different thread holds the
import lock. In the latter case it raises an exception.

Christian


More information about the Python-checkins mailing list