Mercurial > cpython-lru_cache-weakref
diff Lib/importlib/_bootstrap.py @ 55759:e4c2cbd3bf93
Have importlib raise ImportError if None is found in sys.modules. This matches
current import semantics.
| author | Brett Cannon <bcannon@gmail.com> |
|---|---|
| date | Sun, 30 Aug 2009 03:47:36 +0000 |
| parents | dfaf6de2c8ce |
| children | 08090b5e96c2 |
line wrap: on
line diff
--- a/Lib/importlib/_bootstrap.py Sat Aug 29 23:00:38 2009 +0000 +++ b/Lib/importlib/_bootstrap.py Sun Aug 30 03:47:36 2009 +0000 @@ -864,7 +864,12 @@ name = package[:dot] with _ImportLockContext(): try: - return sys.modules[name] + module = sys.modules[name] + if module is None: + message = ("import of {} halted; " + "None in sys.modules".format(name)) + raise ImportError(message) + return module except KeyError: pass parent = name.rpartition('.')[0]
