[issue9260] A finer grained import lock

Brett Cannon report at bugs.python.org
Wed Jul 14 23:29:05 CEST 2010

Brett Cannon <brett at python.org> added the comment:

What I'm saying is that loaders are quite possibly not thread-safe already, so we don't need to do any special for them. If you look at PEP 302 you will notice not a single mention of loaders needing to care about the import lock because there is no mention of the import lock! So changing the locking mechanism most likely won't break loaders because they are not using the current import lock anyway and so already have their own issues.

As long as __import__ does the proper locking on behalf of loaders and we provide a way for people to use the lock if they want to then I am not worried about the impact on loaders. For example, this will change the logic in importlib where the current import lock is grabbed, but otherwise won't change a thing in terms of the code for the various loaders it implements.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list