Stefan Behnel <sco...@users.sourceforge.net> added the comment:

... and the module init function could create and register a different module 
first, and ...

Well, yes, it's a best effort thing. It's rather unlikely that the GIL would 
get released in between the call to the init function and the creation of the 
module within that function, but sure, I don't see a reason why it could not 
happen.

However, it can't happen in moduleobject.c between the NULL check and the 
setting of the __file__ attribute, so that is safe enough to not trigger 
crashes.

And even if the wrong __file__ value is set during the run of the init 
function, it will still get overwritten (and thus fixed) afterwards. So my 
intuition is that code that relies on this new feature will simply have to make 
sure the module object creation is the first thing it does, and code that does 
not rely on it, well, does not rely on it.

----------

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

Reply via email to