diff options
Diffstat (limited to 'Lib/importlib/__init__.py')
-rw-r--r-- | Lib/importlib/__init__.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py index 1bc9947..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,15 +138,15 @@ 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: pkgpath = None target = module spec = module.__spec__ = _bootstrap._find_spec(name, pkgpath, target) - methods = _bootstrap._SpecMethods(spec) - methods.exec(module) + _bootstrap._exec(spec, module) # The module may have replaced itself in sys.modules! return sys.modules[name] finally: |