Issue #15767: Use ModuleNotFoundError.

This commit is contained in:
Eric Snow 2016-09-07 16:56:15 -07:00
parent c943265ba5
commit 46f97b85a8
16 changed files with 337 additions and 284 deletions

View file

@ -350,7 +350,7 @@ def safeimport(path, forceload=0, cache={}):
elif exc is SyntaxError:
# A SyntaxError occurred before we could execute the module.
raise ErrorDuringImport(value.filename, info)
elif exc is ImportError and value.name == path:
elif issubclass(exc, ImportError) and value.name == path:
# No such module in the path.
return None
else: