Close #20839: pkgutil.find_loader now uses importlib.util.find_spec

This commit is contained in:
Nick Coghlan 2014-03-04 20:39:42 +10:00
parent c913a7a6f6
commit dc855b7b1f
4 changed files with 37 additions and 20 deletions

View file

@ -74,15 +74,17 @@ support.
Retrieve a :pep:`302` module loader for the given *fullname*.
This is a convenience wrapper around :func:`importlib.find_loader` that
sets the *path* argument correctly when searching for submodules, and
also ensures parent packages (if any) are imported before searching for
submodules.
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:`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`
.. function:: get_importer(path_item)
@ -109,14 +111,13 @@ support.
not already imported, its containing package (if any) is imported, in order
to establish the package ``__path__``.
This function uses :func:`iter_importers`, and is thus subject to the same
limitations regarding platform-specific special import locations such as the
Windows registry.
.. 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`
.. function:: iter_importers(fullname='')