Visitar URL original
gh-97850: remove ``find_loader`` and ``get_loader`` from ``pkgutil`` by picnixz · Pull Request #119656 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
remove deprecated entries
  • Loading branch information
picnixz committed May 28, 2024
commit 0b0a9fd40ea58db438030761528bc5724115f858
40 changes: 0 additions & 40 deletions Doc/library/pkgutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,6 @@ support.
this function to raise an exception (in line with :func:`os.path.isdir`
behavior).

.. function:: find_loader(fullname)

Retrieve a module :term:`loader` for the given *fullname*.

This is a backwards compatibility wrapper around
:func:`importlib.util.find_spec` that converts most failures to
:exc:`ImportError` and only returns the loader rather than the full
:class:`importlib.machinery.ModuleSpec`.

.. versionchanged:: 3.3
Updated to be based directly on :mod:`importlib` rather than relying
on the package internal :pep:`302` import emulation.

.. versionchanged:: 3.4
Updated to be based on :pep:`451`

.. deprecated-removed:: 3.12 3.14
Use :func:`importlib.util.find_spec` instead.


.. function:: get_importer(path_item)

Expand All @@ -83,27 +64,6 @@ support.
on the package internal :pep:`302` import emulation.


.. function:: get_loader(module_or_name)

Get a :term:`loader` object for *module_or_name*.

If the module or package is accessible via the normal import mechanism, a
wrapper around the relevant part of that machinery is returned. Returns
``None`` if the module cannot be found or imported. If the named module is
not already imported, its containing package (if any) is imported, in order
to establish the package ``__path__``.

.. versionchanged:: 3.3
Updated to be based directly on :mod:`importlib` rather than relying
on the package internal :pep:`302` import emulation.

.. versionchanged:: 3.4
Updated to be based on :pep:`451`

.. deprecated-removed:: 3.12 3.14
Use :func:`importlib.util.find_spec` instead.


.. function:: iter_importers(fullname='')

Yield :term:`finder` objects for the given module name.
Expand Down
3 changes: 1 addition & 2 deletions Lib/test/test_doctest/test_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2407,8 +2407,7 @@ def test_DocFileSuite():
Support for using a package's __loader__.get_data() is also
provided.

>>> import importlib.util, unittest
>>> import test # the module to test
>>> import importlib.util, unittest, test
Comment thread
picnixz marked this conversation as resolved.
Outdated
>>> added_loader = False
>>> if not hasattr(test, '__loader__'):
... spec = importlib.util.find_spec(test.__name__)
Expand Down