Bug #1529871: The speed enhancement patch #921466 broke Python's compliance

with PEP 302.  This was fixed by adding an ``imp.NullImporter`` type that is
used in ``sys.path_importer_cache`` to cache non-directory paths and avoid
excessive filesystem operations during imports.
This commit is contained in:
Phillip J. Eby 2006-07-28 21:12:07 +00:00
parent 944f3b6ecb
commit f7575d0cb7
4 changed files with 161 additions and 38 deletions

View file

@ -381,9 +381,7 @@ def get_importer(path_item):
importer = None
sys.path_importer_cache.setdefault(path_item, importer)
# The boolean values are used for caching valid and invalid
# file paths for the built-in import machinery
if importer in (None, True, False):
if importer is None:
try:
importer = ImpImporter(path_item)
except ImportError: