]> granicus.if.org Git - python/commitdiff
This change makes imputil more closely emulate the standard import
authorThomas Heller <theller@ctypes.org>
Mon, 12 Feb 2001 09:17:06 +0000 (09:17 +0000)
committerThomas Heller <theller@ctypes.org>
Mon, 12 Feb 2001 09:17:06 +0000 (09:17 +0000)
mechanism to support self-modifying modules.

Lib/imputil.py

index 3185d7d94cc1c82b33f345edb15e64953a4e1b9d..2f87d69be97e9224bf2755cf1c62c0bc15cfaf91 100644 (file)
@@ -282,7 +282,8 @@ class Importer:
         if not is_module:
             exec code in module.__dict__
 
-        return module
+        # fetch from sys.modules instead of returning module directly.
+        return sys.modules[fqname]
 
     def _load_tail(self, m, parts):
         """Import the rest of the modules, down from the top-level module.