diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-21 18:33:57 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-21 18:33:57 (GMT) |
commit | c4464052d93de1d34721f673d9d4199428537ae7 (patch) | |
tree | 5b46d8f38b7ecfd3c4829cb37593f8a8ced57755 /Lib/importlib/__init__.py | |
parent | b6e2556d8fbd172181aac09b7536563635af63a9 (diff) | |
download | cpython-c4464052d93de1d34721f673d9d4199428537ae7.zip cpython-c4464052d93de1d34721f673d9d4199428537ae7.tar.gz cpython-c4464052d93de1d34721f673d9d4199428537ae7.tar.bz2 |
Issue #19720: Suppressed context for some exceptions in importlib.
Diffstat (limited to 'Lib/importlib/__init__.py')
-rw-r--r-- | Lib/importlib/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py index e0fe466..e99f50e 100644 --- a/Lib/importlib/__init__.py +++ b/Lib/importlib/__init__.py @@ -73,7 +73,7 @@ def find_loader(name, path=None): except KeyError: pass except AttributeError: - raise ValueError('{}.__loader__ is not set'.format(name)) + raise ValueError('{}.__loader__ is not set'.format(name)) from None spec = _bootstrap._find_spec(name, path) # We won't worry about malformed specs (missing attributes). @@ -138,7 +138,8 @@ def reload(module): parent = sys.modules[parent_name] except KeyError: msg = "parent {!r} not in sys.modules" - raise ImportError(msg.format(parent_name), name=parent_name) + raise ImportError(msg.format(parent_name), + name=parent_name) from None else: pkgpath = parent.__path__ else: |