Details of "import lock" in 3.3

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
With importlib and other recent changes, what are the current details of "import lock"?. That is, the lock/locks held when Python code does "import", specially in the case of multithreading. Is that documented anywhere?
Thanks!
- -- Jesús Cea Avión _/_/ _/_/_/ _/_/_/ jcea@jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea@jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz

Le Fri, 06 Sep 2013 17:08:28 +0200, Jesus Cea jcea@jcea.es a écrit :
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
With importlib and other recent changes, what are the current details of "import lock"?. That is, the lock/locks held when Python code does "import", specially in the case of multithreading. Is that documented anywhere?
Quick summary here: http://docs.python.org/3/whatsnew/3.3.html#a-finer-grained-import-lock
Otherwise, I'm afraid the source code has the most information, e.g.: http://hg.python.org/cpython/file/1d88d04aade2/Lib/importlib/_bootstrap.py#l...
Regards
Antoine.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 06/09/13 17:43, Antoine Pitrou wrote:
Quick summary here: http://docs.python.org/3/whatsnew/3.3.html#a-finer-grained-import-lock
Otherwise, I'm afraid the source code has the most information, e.g.: http://hg.python.org/cpython/file/1d88d04aade2/Lib/importlib/_bootstrap.py#l...
Yes,
I was depending of the global import lock in my code. I am evaluating impact under Python 3.3.
Under Python 3.3, metafinder/loader MUST BE reentrant?.
Can they count on the fact that they could be called concurrently by multiple threads but NOT for importing the SAME module?.
- -- Jesús Cea Avión _/_/ _/_/_/ _/_/_/ jcea@jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea@jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz

On Fri, 06 Sep 2013 18:02:32 +0200 Jesus Cea jcea@jcea.es wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 06/09/13 17:43, Antoine Pitrou wrote:
Quick summary here: http://docs.python.org/3/whatsnew/3.3.html#a-finer-grained-import-lock
Otherwise, I'm afraid the source code has the most information, e.g.: http://hg.python.org/cpython/file/1d88d04aade2/Lib/importlib/_bootstrap.py#l...
Yes,
I was depending of the global import lock in my code. I am evaluating impact under Python 3.3.
Under Python 3.3, metafinder/loader MUST BE reentrant?.
No, they shouldn't have to. Normally, the global import lock is still held at this point. However, it is best to check the code if you want to be sure.
Regards
Antoine.
participants (2)
-
Antoine Pitrou
-
Jesus Cea