[New-bugs-announce] [issue15473] importlib no longer uses imp.NullImporter

Barry A. Warsaw report at bugs.python.org
Fri Jul 27 20:36:57 CEST 2012


New submission from Barry A. Warsaw <barry at python.org>:

I think this is mostly just out of date documentation, but I want to get Brett's feedback.  The sys module has this to say about sys.path_importer_cache:

"A dictionary acting as a cache for finder objects. The keys are paths that have been passed to sys.path_hooks and the values are the finders that are found. If a path is a valid file system path but no explicit finder is found on sys.path_hooks then None is stored to represent the implicit default finder should be used. If the path is not an existing path then imp.NullImporter is set."

Notice that last sentence.  AFAICT, this is not true in importlib.  I can find no relevant reference to imp.NullImporter in _bootstrap.py.  Maybe we should just remove this from the documentation?  OTOH, there are a few tests that check semantics related to imp.NullImporter found in sys.path_importer_cache, so clearly there are API constraints.  See also runpy.py, which gives some semantics to finding this importer in the cache.

Any suggestions for better wording about imp.NullImporter and sys.path_importer_cache?  I'd like to add this to my rewritten import machinery docs, but I'm not exactly sure what to say about it.

----------
assignee: brett.cannon
components: Documentation
messages: 166595
nosy: barry, brett.cannon, eric.smith, ncoghlan
priority: normal
severity: normal
status: open
title: importlib no longer uses imp.NullImporter
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15473>
_______________________________________


More information about the New-bugs-announce mailing list