New submission from Václav Šmilauer:
This issue was split off issue16194 (I am not copying the whole discussion
here). It was suggested a new issue is opened for Python3, where a proper fix
can be done.
Python internally caches dynamically loaded modules, but the cache is based on
the filename only. If one file contains several modules, only the first of them
is imported and initialized properly. This interface was previously exposed via
imp.load_dynamic, the same codepath is used by
A solution is to cache by the (filename, modulename) tuple, which avoids any
I am attaching a simple patch for that, agains current hg tip
(80272:ec00f8570c55), and tested with the scripot attached to issue16194.
I have not modified the test suite, I am not sure whether testing compiled
modules is actually supported (did not see any compiled files in there), I will
be glad for help.
components: Extension Modules
nosy: Arfrever, amaury.forgeotdarc, brett.cannon, docs@python, eudoxos,
title: importlib.machinery.ExtensionFileLoader cannot load several modules from
the same shared object
versions: Python 3.5
Added file: http://bugs.python.org/file27909/many-modules-in-one-so_1.diff
Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list