summaryrefslogtreecommitdiff
path: root/Lib/importlib/_bootstrap_external.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2020-12-04 15:39:21 -0800
committerGitHub <noreply@github.com>2020-12-04 15:39:21 -0800
commit2de5097ba4c50eba90df55696a7b2e74c93834d4 (patch)
tree7a3d54477997114ef27136e9c9da0e380f835a34 /Lib/importlib/_bootstrap_external.py
parent79c1849b9e5b635bd36b13e1be9dc7cbc2bd6312 (diff)
downloadcpython-git-2de5097ba4c50eba90df55696a7b2e74c93834d4.tar.gz
bpo-26131: Deprecate usage of load_module() (GH-23469)
Raise an ImportWarning when the import system falls back on load_module(). As for implementations of load_module(), raise a DeprecationWarning.
Diffstat (limited to 'Lib/importlib/_bootstrap_external.py')
-rw-r--r--Lib/importlib/_bootstrap_external.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index b8dd128238..d9e44df409 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -832,7 +832,8 @@ class _LoaderBasics:
_bootstrap._call_with_frames_removed(exec, code, module.__dict__)
def load_module(self, fullname):
- """This module is deprecated."""
+ """This method is deprecated."""
+ # Warning implemented in _load_module_shim().
return _bootstrap._load_module_shim(self, fullname)
@@ -1007,7 +1008,7 @@ class FileLoader:
"""
# The only reason for this method is for the name check.
# Issue #14857: Avoid the zero-argument form of super so the implementation
- # of that form can be updated without breaking the frozen module
+ # of that form can be updated without breaking the frozen module.
return super(FileLoader, self).load_module(fullname)
@_check_name
@@ -1253,6 +1254,7 @@ class _NamespaceLoader:
# The import system never calls this method.
_bootstrap._verbose_message('namespace module loaded with path {!r}',
self._path)
+ # Warning implemented in _load_module_shim().
return _bootstrap._load_module_shim(self, fullname)