Nick Coghlan added the comment:

Looking at the implementation of PyImport_ImportModuleNoBlock, you should be 
able to invoke that via ctypes with a nonsense module name to probe for whether 
or not the current thread has the import lock.

A call like 'PyImport_ImportModuleNoBlock("this-is-not-a-legal-module-name")' 
will always fail with ImportError, but the exception message will be different 
if another thread holds the import lock. Specifically, it will end with 
"because the import lock is held by another thread".


Python tracker <>
Python-bugs-list mailing list

Reply via email to