Kaydet (Commit) fddc311f authored tarafından Brett Cannon's avatar Brett Cannon

Don't assume trying to find a builtin will succeed (e.g. posix isn't on Windows)

üst 29eac42f
......@@ -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()
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment