summaryrefslogtreecommitdiffstats
path: root/Lib/pkgutil.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/pkgutil.py')
-rw-r--r--Lib/pkgutil.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py
index ef027be..932abbc 100644
--- a/Lib/pkgutil.py
+++ b/Lib/pkgutil.py
@@ -379,18 +379,15 @@ def get_importer(path_item):
for path_hook in sys.path_hooks:
try:
importer = path_hook(path_item)
+ sys.path_importer_cache.setdefault(path_item, importer)
break
except ImportError:
pass
else:
- importer = None
- sys.path_importer_cache.setdefault(path_item, importer)
-
- if importer is None:
- try:
- importer = ImpImporter(path_item)
- except ImportError:
- importer = None
+ try:
+ importer = ImpImporter(path_item)
+ except ImportError:
+ importer = None
return importer