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 <rep...@bugs.python.org> <http://bugs.python.org/issue23068> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com