Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
However!  pip 22.2.2 still relies on pkgutil.ImpImporter so these things
cannot be removed until this issue is resolved:

pypa/pip#11501
  • Loading branch information
warsaw committed Oct 9, 2022
1 parent 4832f66 commit 64d16c9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 34 deletions.
27 changes: 0 additions & 27 deletions Doc/library/pkgutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,33 +48,6 @@ support.
this function to raise an exception (in line with :func:`os.path.isdir`
behavior).


.. class:: ImpImporter(dirname=None)

:pep:`302` Finder that wraps Python's "classic" import algorithm.

If *dirname* is a string, a :pep:`302` finder is created that searches that
directory. If *dirname* is ``None``, a :pep:`302` finder is created that
searches the current :data:`sys.path`, plus any modules that are frozen or
built-in.

Note that :class:`ImpImporter` does not currently support being used by
placement on :data:`sys.meta_path`.

.. deprecated:: 3.3
This emulation is no longer needed, as the standard import mechanism
is now fully :pep:`302` compliant and available in :mod:`importlib`.


.. class:: ImpLoader(fullname, file, filename, etc)

:term:`Loader <loader>` that wraps Python's "classic" import algorithm.

.. deprecated:: 3.3
This emulation is no longer needed, as the standard import mechanism
is now fully :pep:`302` compliant and available in :mod:`importlib`.


.. function:: find_loader(fullname)

Retrieve a module :term:`loader` for the given *fullname*.
Expand Down
2 changes: 1 addition & 1 deletion Lib/pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,7 @@ def run(self, callback, key=None, completer=None, onerror=None):
callback(None, modname, '')
else:
try:
spec = pkgutil._get_spec(importer, modname)
spec = importer.find_spec(importer, modname)
except SyntaxError:
# raised by tests for bad coding cookies or BOM
continue
Expand Down
6 changes: 2 additions & 4 deletions Lib/test/test_importlib/test_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ def test_invalidate_caches(self):

class PathEntryFinder:

def find_loader(self, fullname):
return super().find_loader(fullname)
pass


class PathEntryFinderDefaultsTests(ABCTestHarness):
Expand All @@ -186,8 +185,7 @@ def test_invalidate_caches(self):

class Loader:

def load_module(self, fullname):
return super().load_module(fullname)
pass


class LoaderDefaultsTests(ABCTestHarness):
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,8 @@ def nicer_error(self):
try:
yield
except subprocess.CalledProcessError as exc:
out = exc.output.decode(errors="replace")
err = exc.stderr.decode(errors="replace")
out = 'No output' if exc.output is None else exc.output.decode(errors="replace")
err = 'No stderr' if exc.stderr is None else exc.stderr.decode(errors="replace")
self.fail(
f"{exc}\n\n"
f"**Subprocess Output**\n{out}\n\n"
Expand Down

0 comments on commit 64d16c9

Please sign in to comment.