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 Arfrever, amaury.forgeotdarc, eric.snow, jcea, loewis, scoder
Date 2011-11-20.16:42:10
SpamBayes Score 8.516521e-12
Marked as misclassified No
Message-id <>
As MvL noted in his response to issue 13431, simply adding a parameter to the module init function cannot safely be done before Python 4. So we are back to the idea of passing the information through to the module creation function, i.e. this very issue.

A variant of the implementation would be to store the context information in thread local storage instead of a global variable. That would work around any threading issues. However, this would not be required in the normal import case, only in the reinit case, as the import case is protected by the import lock, as we have seen. Personally, I do not consider this a good idea for the time being, since I doubt that the number of users for the reinitialisation API is currently worth caring about.

In any case, the semantics of __file__ for extension modules would basically become that __file__ refers to the last library that was loaded before calling the module init function. So all extension modules that this init function creates will inherit the same __file__. My guess is that they currently end up with no __file__ attribute at all, as the loader only sets it on the module that the init function returns. So I consider that an improvement already.
Date User Action Args
2011-11-20 16:42:11scodersetrecipients: + scoder, loewis, jcea, amaury.forgeotdarc, Arfrever, eric.snow
2011-11-20 16:42:11scodersetmessageid: <>
2011-11-20 16:42:10scoderlinkissue13429 messages
2011-11-20 16:42:10scodercreate