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

Skip to content

Commit 2514b48

Browse files
committed
Issue #17176: Document that imp.NullImporter is no longer inserted
into sys.path_importer_cache.
1 parent 8c457d2 commit 2514b48

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

Doc/library/imp.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,16 +326,17 @@ to indicate the search result of :func:`find_module`.
326326
with an existing directory or empty string raises :exc:`ImportError`.
327327
Otherwise, a :class:`NullImporter` instance is returned.
328328

329-
Python adds instances of this type to ``sys.path_importer_cache`` for any path
330-
entries that are not directories and are not handled by any other path hooks on
331-
``sys.path_hooks``. Instances have only one method:
332-
329+
Instances have only one method:
333330

334331
.. method:: NullImporter.find_module(fullname [, path])
335332

336333
This method always returns ``None``, indicating that the requested module could
337334
not be found.
338335

336+
.. versionchanged:: 3.3
337+
``None`` is inserted into ``sys.path_importer_cache`` instead of an
338+
instance of :class:`NullImporter`.
339+
339340

340341
.. _examples-imp:
341342

Doc/library/sys.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,12 +785,15 @@ always available.
785785
A dictionary acting as a cache for :term:`finder` objects. The keys are
786786
paths that have been passed to :data:`sys.path_hooks` and the values are
787787
the finders that are found. If a path is a valid file system path but no
788-
explicit finder is found on :data:`sys.path_hooks` then ``None`` is
789-
stored to represent the implicit default finder should be used. If the path
790-
is not an existing path then :class:`imp.NullImporter` is set.
788+
finder is found on :data:`sys.path_hooks` then ``None`` is
789+
stored.
791790

792791
Originally specified in :pep:`302`.
793792

793+
.. versionchanged:: 3.3
794+
``None`` is stored instead of :class:`imp.NullImporter` when no finder
795+
is found.
796+
794797

795798
.. data:: platform
796799

0 commit comments

Comments
 (0)