[issue40427] importlib of module results in different id than when imported with import keyword

Brett Cannon report at bugs.python.org
Tue Apr 28 15:08:01 EDT 2020


Brett Cannon <brett at python.org> added the comment:

That's expected because you are constructing a completely new module object with importlib.util.module_from_spec(). You're also completely circumventing sys.modules with the code you wrote which is the only way you would get equivalent IDs compared to using the import statement.

So this is working as intended.

----------
nosy: +brett.cannon
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40427>
_______________________________________


More information about the Python-bugs-list mailing list