diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2013-08-15 00:03:34 (GMT) |
---|---|---|
committer | Eric Snow <ericsnowcurrently@gmail.com> | 2013-08-15 00:03:34 (GMT) |
commit | 7491f1726ba3a5f78beddca2280f9141d559ff1c (patch) | |
tree | a272bd5852fe3662a81dfc78481f6aa88a68a870 /Lib/imp.py | |
parent | e76c0393a8dc35af38d6d2af2827f405a7ef6116 (diff) | |
download | cpython-7491f1726ba3a5f78beddca2280f9141d559ff1c.zip cpython-7491f1726ba3a5f78beddca2280f9141d559ff1c.tar.gz cpython-7491f1726ba3a5f78beddca2280f9141d559ff1c.tar.bz2 |
issue #18698: ensure importlib.reload() returns the module out of sys.modules.
Diffstat (limited to 'Lib/imp.py')
-rw-r--r-- | Lib/imp.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -268,7 +268,9 @@ def reload(module): if parent_name and parent_name not in sys.modules: msg = "parent {!r} not in sys.modules" raise ImportError(msg.format(parent_name), name=parent_name) - return module.__loader__.load_module(name) + module.__loader__.load_module(name) + # The module may have replaced itself in sys.modules! + return sys.modules[module.__name__] finally: try: del _RELOADING[name] |