Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Doc/deprecations/pending-removal-in-3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,8 @@ 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.
3 changes: 0 additions & 3 deletions Doc/deprecations/pending-removal-in-future.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,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.
9 changes: 5 additions & 4 deletions Lib/zipimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import marshal # for loads
import sys # for modules
import time # for mktime
import _warnings # For warn()
import warnings # For warnings

__all__ = ['ZipImportError', 'zipimporter']

Expand Down Expand Up @@ -221,9 +221,10 @@ 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)
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):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Delay deprecated :meth:`~zipimport.zipimporter.load_module` removal
time to 3.15. Use :meth:`~zipimport.zipimporter.exec_module` instead.
Loading