summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/_bootstrap.py
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2016-09-08 18:12:31 (GMT)
committerEric Snow <ericsnowcurrently@gmail.com>2016-09-08 18:12:31 (GMT)
commitf3fd06a2e4d42cf8e4e82a5b6cbff1e5a515aff3 (patch)
tree41daf3438e6f223089206197f1dba3f843076be3 /Lib/importlib/_bootstrap.py
parente58571b7eaa3f282d7d29f3aead1cc8220bec473 (diff)
downloadcpython-f3fd06a2e4d42cf8e4e82a5b6cbff1e5a515aff3.zip
cpython-f3fd06a2e4d42cf8e4e82a5b6cbff1e5a515aff3.tar.gz
cpython-f3fd06a2e4d42cf8e4e82a5b6cbff1e5a515aff3.tar.bz2
Issue #28026: Raise ImportError when exec_module() exists but create_module() is missing.
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 8cd0262..a531a03 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)