diff options
author | Meador Inge <meadori@gmail.com> | 2011-12-15 04:27:28 (GMT) |
---|---|---|
committer | Meador Inge <meadori@gmail.com> | 2011-12-15 04:27:28 (GMT) |
commit | d7afeeeb8dc8b4e2e59951a15b68f362282d447e (patch) | |
tree | 6e05ec5b94407e928228641563b41a47184137ee /Lib/importlib/_bootstrap.py | |
parent | abbcd0872fc970bb83d8ff5f0f09ca988c172360 (diff) | |
parent | 416f12ddb3b7d780bb75563414b88b32c0cf7e67 (diff) | |
download | cpython-d7afeeeb8dc8b4e2e59951a15b68f362282d447e.zip cpython-d7afeeeb8dc8b4e2e59951a15b68f362282d447e.tar.gz cpython-d7afeeeb8dc8b4e2e59951a15b68f362282d447e.tar.bz2 |
Issue #13591: import_module potentially imports a module twice.
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 359b9e7..25533fc 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -837,7 +837,9 @@ def _gcd_import(name, package=None, level=0): for finder in meta_path: loader = finder.find_module(name, path) if loader is not None: - loader.load_module(name) + # The parent import may have already imported this module. + if name not in sys.modules: + loader.load_module(name) break else: raise ImportError(_ERR_MSG.format(name)) |