Antoine Pitrou <pit...@free.fr> added the comment:

> PyImport_ExecCodeModuleEx adds the module to sys.modules *before*
> actually executing the code. This is a design flaw (can it really be
> changed? )

I guess it is done so to allow for circular imports.

> The second bug: in cPickle.c: func_class() 
> cPickle 'manually' checks if a module is in sys.modules instead of
> letting the import mechanism do it for him (hence breaking the import
> lock's defense here).

I would guess it is an optimization shortcut. A solution (while keeping the 
optimization) would be to take the import lock before checking sys.modules.

Note that the _pickle module in 3.x has the same kind of logic, and therefore 
probably the same issue too (haven't tested).

----------
nosy: +pitrou
versions: +Python 3.2, Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12680>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to