mirror of
https://github.com/python/cpython.git
synced 2025-07-31 07:04:42 +00:00
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:
parent
944f3b6ecb
commit
f7575d0cb7
4 changed files with 161 additions and 38 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue