Eric Snow added the comment:

Keep in mind that the global import lock is only held long enough to create a 
module-level lock.  The cache of module locks is found at line 166 of 
Lib/importlib/_bootstrap.py and the code related to module-level locking 
follows.  So unfortunately it won't be as simple as just getting the thread 
info from the global import lock.

Regardless, would it be useful to expose a function in importlib.util that 
indicates whether or not the current thread is importing a module (actually the 
names of the modules it is importing)?  Something like that would probably 
check both the global import lock and the module level locks, but make it 
unnecessary to expose the locks directly.  Given the situation with 
module-level locks I image such a helper is going to be desirable.

----------
nosy: +brett.cannon, eric.snow, ncoghlan

_______________________________________
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

Reply via email to