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

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.

----------

_______________________________________
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