[docs] [issue16194] imp.load_dynamic imports wrong module when called several times on a multi-module .so

Nick Coghlan report at bugs.python.org
Thu Nov 29 16:08:52 CET 2012


Nick Coghlan added the comment:

The behaviour won't change in 2.7, but the docs at http://docs.python.org/2/library/imp.html#imp.load_dynamic still need to be clarified.

e.g. add a note like:

Note: the import internals identify extension modules by filename, so doing ``foo = load_dynamic("foo", "mod.so")`` and ``bar = load_dynamic("bar", "mod.so")`` will result in both foo and bar referring to the same module, regardless of whether or not ``mod.so`` exports an ``initbar`` function. On systems which support them, symlinks can be used to import multiple modules from the same shared library, as each reference to the module will use a different file name.

(probably flagged as a CPython implementation detail, since it's really an accident of the implementation rather than a deliberately considered language feature)

----------

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


More information about the docs mailing list