https://github.com/python/cpython/commit/06ac157c53046f4fcad34383ef131f773085f3d5
commit: 06ac157c53046f4fcad34383ef131f773085f3d5
branch: main
author: Wulian233 <[email protected]>
committer: brettcannon <[email protected]>
date: 2025-02-11T23:59:09Z
summary:
gh-125746: Delay deprecated `zipimport.zipimporter.load_module` removal time to
3.15 (#125748)
files:
A Misc/NEWS.d/next/Library/2024-10-20-13-01-05.gh-issue-125746.wDLTay.rst
M Doc/deprecations/pending-removal-in-3.15.rst
M Doc/deprecations/pending-removal-in-future.rst
M Doc/library/zipimport.rst
M Lib/zipimport.py
diff --git a/Doc/deprecations/pending-removal-in-3.15.rst
b/Doc/deprecations/pending-removal-in-3.15.rst
index e269681593c7c6..92297e1518004d 100644
--- a/Doc/deprecations/pending-removal-in-3.15.rst
+++ b/Doc/deprecations/pending-removal-in-3.15.rst
@@ -96,3 +96,9 @@ Pending removal in Python 3.15
and :meth:`~wave.Wave_read.getmarkers` methods of
the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes
have been deprecated since Python 3.13.
+
+* :mod:`zipimport`:
+
+ * :meth:`~zipimport.zipimporter.load_module` has been deprecated since
+ Python 3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead.
+ (Contributed by Jiahao Li in :gh:`125746`.)
diff --git a/Doc/deprecations/pending-removal-in-future.rst
b/Doc/deprecations/pending-removal-in-future.rst
index d8d7ad8c783158..42dce518717a85 100644
--- a/Doc/deprecations/pending-removal-in-future.rst
+++ b/Doc/deprecations/pending-removal-in-future.rst
@@ -151,6 +151,3 @@ although there is currently no date scheduled for their
removal.
:class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it
will always return ``True``. Prefer explicit ``len(elem)`` or
``elem is not None`` tests instead.
-
-* :meth:`zipimport.zipimporter.load_module` is deprecated:
- use :meth:`~zipimport.zipimporter.exec_module` instead.
diff --git a/Doc/library/zipimport.rst b/Doc/library/zipimport.rst
index 9353a45bdcecba..cd76f29a556939 100644
--- a/Doc/library/zipimport.rst
+++ b/Doc/library/zipimport.rst
@@ -148,7 +148,7 @@ zipimporter Objects
qualified (dotted) module name. Returns the imported module on success,
raises :exc:`ZipImportError` on failure.
- .. deprecated:: 3.10
+ .. deprecated-removed:: 3.10 3.15
Use :meth:`exec_module` instead.
diff --git a/Lib/zipimport.py b/Lib/zipimport.py
index e5192c4d074c4b..444c9dd11d8672 100644
--- a/Lib/zipimport.py
+++ b/Lib/zipimport.py
@@ -20,7 +20,6 @@
import marshal # for loads
import sys # for modules
import time # for mktime
-import _warnings # For warn()
__all__ = ['ZipImportError', 'zipimporter']
@@ -221,9 +220,11 @@ def load_module(self, fullname):
Deprecated since Python 3.10. Use exec_module() instead.
"""
- msg = ("zipimport.zipimporter.load_module() is deprecated and slated
for "
- "removal in Python 3.12; use exec_module() instead")
- _warnings.warn(msg, DeprecationWarning)
+ import warnings
+ warnings._deprecated("zipimport.zipimporter.load_module",
+ f"{warnings._DEPRECATED_MSG}; "
+ "use zipimport.zipimporter.exec_module() instead",
+ remove=(3, 15))
code, ispackage, modpath = _get_module_code(self, fullname)
mod = sys.modules.get(fullname)
if mod is None or not isinstance(mod, _module_type):
diff --git
a/Misc/NEWS.d/next/Library/2024-10-20-13-01-05.gh-issue-125746.wDLTay.rst
b/Misc/NEWS.d/next/Library/2024-10-20-13-01-05.gh-issue-125746.wDLTay.rst
new file mode 100644
index 00000000000000..387d793fd209d9
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-10-20-13-01-05.gh-issue-125746.wDLTay.rst
@@ -0,0 +1,2 @@
+Delay deprecated :meth:`zipimport.zipimporter.load_module` removal
+time to 3.15. Use :meth:`zipimport.zipimporter.exec_module` instead.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]