[issue30891] importlib: _find_and_load() race condition on sys.modules[name] check

Łukasz Langa report at bugs.python.org
Mon Apr 2 13:46:21 EDT 2018


Łukasz Langa <lukasz at langa.pl> added the comment:

In the context of this issue: zipimport doesn't properly lock on imports happening in multiple threads at the same time. This causes one thread to receive a partially imported module while the other thread is still performing the import.

zipimport also doesn't properly check __pycache__ directories but *does* look for old-style .pyc files next to the corresponding .py file.

IIRC Brett chooses not to deal with zipimport's warts and has no time to rewrite it in Python. Since the rest of the core team is less qualified, they steer clear, too.

So, don't use zipimport.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue30891>
_______________________________________


More information about the Python-bugs-list mailing list