summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/importlib/__init__.py')
-rw-r--r--Lib/importlib/__init__.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py
index 86febff..cb37d24 100644
--- a/Lib/importlib/__init__.py
+++ b/Lib/importlib/__init__.py
@@ -164,6 +164,8 @@ def reload(module):
pkgpath = None
target = module
spec = module.__spec__ = _bootstrap._find_spec(name, pkgpath, target)
+ if spec is None:
+ raise ModuleNotFoundError(f"spec not found for the module {name!r}", name=name)
_bootstrap._exec(spec, module)
# The module may have replaced itself in sys.modules!
return sys.modules[name]