[issue13429] provide __file__ to extension init function

Amaury Forgeot d'Arc report at bugs.python.org
Fri Nov 18 21:31:12 CET 2011


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

> ... and the module init function could create and register a
> different module first, and ...
Actually, this *does* happen, the PIL module is written this way.
And I don't agree with the "best effort" argument.  If there is a slight chance that this does not work, we'll have to fix it sooner or later.

But please check this import lock thing: if _PyImport_AcquireLock and _PyImport_ReleaseLock are always called around extension module initialization, then we don't have to worry about other threads; and nested calls are already handled by the "oldimportcontext" variable in your patch.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13429>
_______________________________________


More information about the Python-bugs-list mailing list