Mercurial > cpython-lru_cache-weakref
diff Lib/importlib/_bootstrap.py @ 73973:d2504d30f259 3.2
Issue #13591: import_module potentially imports a module twice.
| author | Meador Inge <meadori@gmail.com> |
|---|---|
| date | Wed, 14 Dec 2011 22:23:46 -0600 |
| parents | 81d7f78a633a |
| children | fdf907708f49 e8fb61a0a2d7 |
line wrap: on
line diff
--- a/Lib/importlib/_bootstrap.py Wed Dec 14 15:06:50 2011 -0800 +++ b/Lib/importlib/_bootstrap.py Wed Dec 14 22:23:46 2011 -0600 @@ -816,7 +816,9 @@ 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))
