Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bfae196

Browse files
author
Thomas Heller
committed
This change makes imputil more closely emulate the standard import
mechanism to support self-modifying modules.
1 parent 76c066b commit bfae196

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/imputil.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ def _process_result(self, (ispkg, code, values), fqname):
282282
if not is_module:
283283
exec code in module.__dict__
284284

285-
return module
285+
# fetch from sys.modules instead of returning module directly.
286+
return sys.modules[fqname]
286287

287288
def _load_tail(self, m, parts):
288289
"""Import the rest of the modules, down from the top-level module.

0 commit comments

Comments
 (0)