diff options
author | Brett Cannon <brett@python.org> | 2013-11-22 16:58:17 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-11-22 16:58:17 (GMT) |
commit | fddc311fe84f6d0a51971c080a5b1089d99c31e6 (patch) | |
tree | 924d0692ea3140c25e2939615b849030a85b7ca9 /Lib/importlib | |
parent | 29eac42f4996323318c5dcbe670f3a382fda5db9 (diff) | |
download | cpython-fddc311fe84f6d0a51971c080a5b1089d99c31e6.zip cpython-fddc311fe84f6d0a51971c080a5b1089d99c31e6.tar.gz cpython-fddc311fe84f6d0a51971c080a5b1089d99c31e6.tar.bz2 |
Don't assume trying to find a builtin will succeed (e.g. posix isn't on Windows)
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index a6db00b..858d181 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -2268,6 +2268,8 @@ def __import__(name, globals=None, locals=None, fromlist=(), level=0): def _builtin_from_name(name): spec = BuiltinImporter.find_spec(name) + if spec is None: + raise ImportError('no built-in module named ' + name) methods = _SpecMethods(spec) return methods._load_unlocked() |