Author ncoghlan
Recipients brett.cannon, eric.snow, gvanrossum, ncoghlan
Date 2014-12-17.23:14:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1418858080.35.0.286462910971.issue23068@psf.upfronthosting.co.za>
In-reply-to
Content
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".
History
Date User Action Args
2014-12-17 23:14:40ncoghlansetrecipients: + ncoghlan, gvanrossum, brett.cannon, eric.snow
2014-12-17 23:14:40ncoghlansetmessageid: <1418858080.35.0.286462910971.issue23068@psf.upfronthosting.co.za>
2014-12-17 23:14:40ncoghlanlinkissue23068 messages
2014-12-17 23:14:40ncoghlancreate