gh-97850: Update the deprecation warning of importlib.abc.Loader.load_module (GH-129855)

This commit is contained in:
Tomas R. 2025-02-11 20:04:16 +01:00 committed by GitHub
parent 5cdd6e5e75
commit aa81a6f6e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 8 deletions

View file

@ -29,6 +29,10 @@ Pending removal in Python 3.15
* The :option:`!--cgi` flag to the :program:`python -m http.server` * The :option:`!--cgi` flag to the :program:`python -m http.server`
command-line interface has been deprecated since Python 3.13. command-line interface has been deprecated since Python 3.13.
* :mod:`importlib`:
* ``load_module()`` method: use ``exec_module()`` instead.
* :class:`locale`: * :class:`locale`:
* The :func:`~locale.getdefaultlocale` function * The :func:`~locale.getdefaultlocale` function

View file

@ -63,7 +63,6 @@ although there is currently no date scheduled for their removal.
* :mod:`importlib`: * :mod:`importlib`:
* ``load_module()`` method: use ``exec_module()`` instead.
* :func:`~importlib.util.cache_from_source` *debug_override* parameter is * :func:`~importlib.util.cache_from_source` *debug_override* parameter is
deprecated: use the *optimization* parameter instead. deprecated: use the *optimization* parameter instead.

View file

@ -370,7 +370,7 @@ ABC hierarchy::
:exc:`NotImplementedError`. Functionality provided when :exc:`NotImplementedError`. Functionality provided when
:meth:`exec_module` is available. :meth:`exec_module` is available.
.. deprecated:: 3.4 .. deprecated-removed:: 3.4 3.15
The recommended API for loading a module is :meth:`exec_module` The recommended API for loading a module is :meth:`exec_module`
(and :meth:`create_module`). Loaders should implement it instead of (and :meth:`create_module`). Loaders should implement it instead of
:meth:`load_module`. The import machinery takes care of all the :meth:`load_module`. The import machinery takes care of all the
@ -474,7 +474,7 @@ ABC hierarchy::
Implementation of :meth:`Loader.load_module`. Implementation of :meth:`Loader.load_module`.
.. deprecated:: 3.4 .. deprecated-removed:: 3.4 3.15
use :meth:`exec_module` instead. use :meth:`exec_module` instead.
@ -521,7 +521,7 @@ ABC hierarchy::
Calls super's ``load_module()``. Calls super's ``load_module()``.
.. deprecated:: 3.4 .. deprecated-removed:: 3.4 3.15
Use :meth:`Loader.exec_module` instead. Use :meth:`Loader.exec_module` instead.
.. abstractmethod:: get_filename(fullname) .. abstractmethod:: get_filename(fullname)
@ -610,7 +610,7 @@ ABC hierarchy::
Concrete implementation of :meth:`Loader.load_module`. Concrete implementation of :meth:`Loader.load_module`.
.. deprecated:: 3.4 .. deprecated-removed:: 3.4 3.15
Use :meth:`exec_module` instead. Use :meth:`exec_module` instead.
.. method:: get_source(fullname) .. method:: get_source(fullname)
@ -1020,7 +1020,7 @@ find and load modules.
Concrete implementation of :meth:`importlib.abc.Loader.load_module` where Concrete implementation of :meth:`importlib.abc.Loader.load_module` where
specifying the name of the module to load is optional. specifying the name of the module to load is optional.
.. deprecated:: 3.6 .. deprecated-removed:: 3.6 3.15
Use :meth:`importlib.abc.Loader.exec_module` instead. Use :meth:`importlib.abc.Loader.exec_module` instead.
@ -1063,7 +1063,7 @@ find and load modules.
Concrete implementation of :meth:`importlib.abc.Loader.load_module` where Concrete implementation of :meth:`importlib.abc.Loader.load_module` where
specifying the name of the module to load is optional. specifying the name of the module to load is optional.
.. deprecated:: 3.6 .. deprecated-removed:: 3.6 3.15
Use :meth:`importlib.abc.Loader.exec_module` instead. Use :meth:`importlib.abc.Loader.exec_module` instead.

View file

@ -526,7 +526,7 @@ def _load_module_shim(self, fullname):
""" """
msg = ("the load_module() method is deprecated and slated for removal in " msg = ("the load_module() method is deprecated and slated for removal in "
"Python 3.12; use exec_module() instead") "Python 3.15; use exec_module() instead")
_warnings.warn(msg, DeprecationWarning) _warnings.warn(msg, DeprecationWarning)
spec = spec_from_loader(fullname, self) spec = spec_from_loader(fullname, self)
if fullname in sys.modules: if fullname in sys.modules:

View file

@ -0,0 +1,2 @@
Update the deprecation warning of
:meth:`importlib.abc.Loader.load_module`.