summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/_bootstrap.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-08-30 04:29:47 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-08-30 04:29:47 (GMT)
commit8a1a59f0eced3327ccf095a3de05701cdf379ab5 (patch)
treee9e6b7c1fae671e3eb3da088b07406498983f9d7 /Lib/importlib/_bootstrap.py
parentaf0312af7a279ca1ec067728cd71cf8269b4f597 (diff)
downloadcpython-8a1a59f0eced3327ccf095a3de05701cdf379ab5.zip
cpython-8a1a59f0eced3327ccf095a3de05701cdf379ab5.tar.gz
cpython-8a1a59f0eced3327ccf095a3de05701cdf379ab5.tar.bz2
Merged revisions 74584 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r74584 | brett.cannon | 2009-08-29 20:47:36 -0700 (Sat, 29 Aug 2009) | 3 lines Have importlib raise ImportError if None is found in sys.modules. This matches current import semantics. ........
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r--Lib/importlib/_bootstrap.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index ee3f1e6..24bcff2 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -860,7 +860,12 @@ def _gcd_import(name, package=None, level=0):
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]