Antoine Pitrou <solip...@pitrou.net> writes: > Le Wed, 14 Aug 2013 14:17:59 +0900, Arnaud Fontaine > <arnaud.fonta...@nexedi.com> a écrit : >> From my understanding of import.c source code, until something is >> added to sys.modules or the code loaded, there should be no >> side-effect to releasing the lock, right? (eg there is no global >> variables/data being shared for importing modules, meaning that >> releasing the lock should be safe as long as the modules loaded >> through import hooks are protected by a lock) > > Er, probably, but import.c is a nasty pile of code. > It's true the import lock is there mainly to: > - avoid incomplete modules from being seen by other threads > - avoid a module from being executed twice
Yes. Hopefully, the implementation in Python 3.3 should be much better! ;-) > But that doesn't mean it can't have had any other - unintended - > benefits ;-) Indeed, that's why I checked the source code, but I will check again anyway to make sure. > (also, some import hooks might not be thread-safe, something which they > haven't had to bother about until now) Good point, I didn't think about that. Thanks! Regards, -- Arnaud Fontaine _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com