summaryrefslogtreecommitdiffstats
path: root/Lib/pkgutil.py
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-05-03 23:11:54 (GMT)
committerGitHub <noreply@github.com>2023-05-03 23:11:54 (GMT)
commitd6e83fbf30fb25996b547d8a2444814437e228e5 (patch)
tree56a956bc3dcac4bc088742b682300ba6135678b6 /Lib/pkgutil.py
parent9f9e001ab2ab67acdb2e0383a25ab4c164608a47 (diff)
downloadcpython-d6e83fbf30fb25996b547d8a2444814437e228e5.zip
cpython-d6e83fbf30fb25996b547d8a2444814437e228e5.tar.gz
cpython-d6e83fbf30fb25996b547d8a2444814437e228e5.tar.bz2
gh-97850: Deprecate `find_loader` and `get_loader` in `pkgutil` (GH-98520)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Diffstat (limited to 'Lib/pkgutil.py')
-rw-r--r--Lib/pkgutil.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py
index f62eccb..dccbec5 100644
--- a/Lib/pkgutil.py
+++ b/Lib/pkgutil.py
@@ -270,6 +270,10 @@ def get_loader(module_or_name):
If the named module is not already imported, its containing package
(if any) is imported, in order to establish the package __path__.
"""
+ warnings._deprecated("pkgutil.get_loader",
+ f"{warnings._DEPRECATED_MSG}; "
+ "use importlib.util.find_spec() instead",
+ remove=(3, 14))
if module_or_name in sys.modules:
module_or_name = sys.modules[module_or_name]
if module_or_name is None:
@@ -294,6 +298,10 @@ def find_loader(fullname):
importlib.util.find_spec that converts most failures to ImportError
and only returns the loader rather than the full spec
"""
+ warnings._deprecated("pkgutil.find_loader",
+ f"{warnings._DEPRECATED_MSG}; "
+ "use importlib.util.find_spec() instead",
+ remove=(3, 14))
if fullname.startswith('.'):
msg = "Relative module name {!r} not supported".format(fullname)
raise ImportError(msg)