summaryrefslogtreecommitdiff
path: root/Lib/importlib
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2016-09-08 11:12:31 -0700
committerEric Snow <ericsnowcurrently@gmail.com>2016-09-08 11:12:31 -0700
commitf3fd06a2e4d42cf8e4e82a5b6cbff1e5a515aff3 (patch)
tree41daf3438e6f223089206197f1dba3f843076be3 /Lib/importlib
parente58571b7eaa3f282d7d29f3aead1cc8220bec473 (diff)
downloadcpython-git-f3fd06a2e4d42cf8e4e82a5b6cbff1e5a515aff3.tar.gz
Issue #28026: Raise ImportError when exec_module() exists but create_module() is missing.
Diffstat (limited to 'Lib/importlib')
-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)