Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b79b785

Browse files
committed
whatsnew: importlib deprecations.
This addresses issue #20199, if I got it right. The deprecation and replacement lists are based on the importlib documentation.
1 parent 8dfb457 commit b79b785

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

Doc/whatsnew/3.4.rst

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,10 +1504,30 @@ Deprecated Python Modules, Functions and Methods
15041504
:meth:`difflib.SequenceMatcher.isbpopular` were removed: use ``x in sm.bjunk`` and
15051505
``x in sm.bpopular``, where *sm* is a :class:`~difflib.SequenceMatcher` object.
15061506

1507-
* :func:`importlib.util.module_for_loader` is pending deprecation. Using
1508-
:func:`importlib.util.module_to_load` and
1509-
:meth:`importlib.abc.Loader.init_module_attrs` allows subclasses of a loader
1510-
to more easily customize module loading.
1507+
* As mentioned in :ref:`whatsnew-pep-451`, a number of :mod:`importilb`
1508+
methods and functions are deprecated: :meth:`importlib.find_loader` is
1509+
replaced by :func:`importlib.util.find_spec`;
1510+
:meth:`importlib.machinery.PathFinder.find_module` is replaced by
1511+
:meth:`importlib.machinery.PathFinder.find_spec`;
1512+
:meth:`importlib.abc.MetaPathFinder.find_module` is replaced by
1513+
:meth:`importlib.abc.MetaPathFinder.find_spec`;
1514+
:meth:`importlib.abc.PathEntryFinder.find_loader` and
1515+
:meth:`~importlib.abc.PathEntryFinder.find_module` are replaced by
1516+
:meth:`importlib.abc.PathEntryFinder.find_spec`; all of the ``xxxLoader`` ABC
1517+
``load_module`` methods (:meth:`importlib.abc.Loader.load_module`,
1518+
:meth:`importlib.abc.InspectLoader.load_module`,
1519+
:meth:`importlib.abc.FileLoader.load_module`,
1520+
:meth:`importlib.abc.SourceLoader.load_module`) should no longer be
1521+
implemented, instead loaders should implement an
1522+
``exec_module`` method
1523+
(:meth:`importlib.abc.Loader.exec_module`,
1524+
:meth:`importlib.abc.InspectLoader.exec_module`
1525+
:meth:`importlib.abc.SourceLoader.exec_module`) and let the import system
1526+
take care of the rest; and
1527+
:meth:`importlib.abc.Loader.module_repr`,
1528+
:meth:`importlib.util.module_for_loader`, :meth:`importlib.util.set_loader`,
1529+
and :meth:`importlib.util.set_package` are no longer needed because their
1530+
functions are now handled automatically by the import system.
15111531

15121532
* The :mod:`imp` module is pending deprecation. To keep compatibility with
15131533
Python 2/3 code bases, the module's removal is currently not scheduled.

0 commit comments

Comments
 (0)