This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients amaury.forgeotdarc, loewis, scoder
Date 2011-11-18.20:00:09
SpamBayes Score 3.1931648e-09
Marked as misclassified No
Message-id <1321646410.57.0.567479702204.issue13429@psf.upfronthosting.co.za>
In-reply-to
Content
... 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.
History
Date User Action Args
2011-11-18 20:00:10scodersetrecipients: + scoder, loewis, amaury.forgeotdarc
2011-11-18 20:00:10scodersetmessageid: <1321646410.57.0.567479702204.issue13429@psf.upfronthosting.co.za>
2011-11-18 20:00:09scoderlinkissue13429 messages
2011-11-18 20:00:09scodercreate