summaryrefslogtreecommitdiff
path: root/Lib/importlib/_bootstrap.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r--Lib/importlib/_bootstrap.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index 8cd0262bbf..a531a0351d 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -559,9 +559,8 @@ def module_from_spec(spec):
# module creation should be used.
module = spec.loader.create_module(spec)
elif hasattr(spec.loader, 'exec_module'):
- _warnings.warn('starting in Python 3.6, loaders defining exec_module() '
- 'must also define create_module()',
- DeprecationWarning, stacklevel=2)
+ raise ImportError('loaders that define exec_module() '
+ 'must also define create_module()')
if module is None:
module = _new_module(spec.name)
_init_module_attrs(spec, module)