Author eudoxos
Recipients Arfrever, amaury.forgeotdarc, brett.cannon, docs@python, eudoxos, ncoghlan, r.david.murray
Date 2012-11-06.14:42:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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 importlib.machinery.ExtensionFileLoader now.

A solution is to cache by the (filename, modulename) tuple, which avoids any ambiguity.

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.
Date User Action Args
2012-11-06 14:42:53eudoxossetrecipients: + eudoxos, brett.cannon, amaury.forgeotdarc, ncoghlan, Arfrever, r.david.murray, docs@python
2012-11-06 14:42:53eudoxossetmessageid: <>
2012-11-06 14:42:52eudoxoslinkissue16421 messages
2012-11-06 14:42:52eudoxoscreate