[issue19698] Implement _imp.exec_builtin and exec_dynamic

Eric Snow report at bugs.python.org
Fri Dec 6 07:35:08 CET 2013


Eric Snow added the comment:

Is the problem here that builtins (and extension modules) don't necessarily obey the rules to the letter?  load_module() is supposed to use whatever is in sys.modules. [1]  (BuiltinImporter.load_module() is essentially a synonym for _imp.init_builtin(), right?)

So in each PyInit_*() the code should be using the module out of sys.modules...  That sounds like a bug and I expect that the builtin modules and most extension modules don't comply.

That said, I realize the spirit of the load_module() rule is to support reloading, which is mostly not applicable to builtins and extension modules.  The code you reverted would rely on enforcing the rule outside the implicit applicability.

I'll be glad when we've resolved the extension module API changes that support exec_module()!

[1] http://docs.python.org/dev/library/importlib.html#importlib.abc.Loader.load_module

----------

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


More information about the Python-bugs-list mailing list