diff options
author | Brett Cannon <brett@python.org> | 2021-04-06 15:56:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 15:56:57 (GMT) |
commit | 57c6cb5100d19a0e0218c77d887c3c239c9ce435 (patch) | |
tree | 8e193c0bc12f476821639c8363d280ef9d604271 /Lib/importlib/_bootstrap_external.py | |
parent | efccff9ac84009ef48e8cb22548ce80940f76533 (diff) | |
download | cpython-57c6cb5100d19a0e0218c77d887c3c239c9ce435.zip cpython-57c6cb5100d19a0e0218c77d887c3c239c9ce435.tar.gz cpython-57c6cb5100d19a0e0218c77d887c3c239c9ce435.tar.bz2 |
bpo-42135: Deprecate implementations of find_module() and find_loader() (GH-25169)
Diffstat (limited to 'Lib/importlib/_bootstrap_external.py')
-rw-r--r-- | Lib/importlib/_bootstrap_external.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index d351ee0..34f554a 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -533,6 +533,9 @@ def _find_module_shim(self, fullname): This method is deprecated in favor of finder.find_spec(). """ + _warnings.warn("find_module() is deprecated and " + "slated for removal in Python 3.12; use find_spec() instead", + DeprecationWarning) # Call find_loader(). If it returns a string (indicating this # is a namespace package portion), generate a warning and # return None. @@ -801,9 +804,12 @@ class WindowsRegistryFinder: def find_module(cls, fullname, path=None): """Find module named in the registry. - This method is deprecated. Use exec_module() instead. + This method is deprecated. Use find_spec() instead. """ + _warnings.warn("WindowsRegistryFinder.find_module() is deprecated and " + "slated for removal in Python 3.12; use find_spec() instead", + DeprecationWarning) spec = cls.find_spec(fullname, path) if spec is not None: return spec.loader @@ -1404,6 +1410,9 @@ class PathFinder: This method is deprecated. Use find_spec() instead. """ + _warnings.warn("PathFinder.find_module() is deprecated and " + "slated for removal in Python 3.12; use find_spec() instead", + DeprecationWarning) spec = cls.find_spec(fullname, path) if spec is None: return None @@ -1459,6 +1468,9 @@ class FileFinder: This method is deprecated. Use find_spec() instead. """ + _warnings.warn("FileFinder.find_loader() is deprecated and " + "slated for removal in Python 3.12; use find_spec() instead", + DeprecationWarning) spec = self.find_spec(fullname) if spec is None: return None, [] |