summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/_bootstrap.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-03-30 19:57:15 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-03-30 19:57:15 (GMT)
commit8593a7568817bf36039460e34826822bec9c3904 (patch)
treea9d149001ca961556ea5d7c41b3a5f869a77fcbe /Lib/importlib/_bootstrap.py
parent0e314548c2e8dac3fa714bdf75b3ea7554c1368d (diff)
downloadcpython-8593a7568817bf36039460e34826822bec9c3904.zip
cpython-8593a7568817bf36039460e34826822bec9c3904.tar.gz
cpython-8593a7568817bf36039460e34826822bec9c3904.tar.bz2
Fix importlib.machinery.PathFinder.find_module() to essentially skip over None
entries in sys.path_importer_cache. While this differs from semantics in how __import__ works, it prevents any implicit semantics from taking hold with users.
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r--Lib/importlib/_bootstrap.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index d5b909e..949a612 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -661,9 +661,10 @@ class PathFinder:
finder = cls._path_importer_cache(entry)
except ImportError:
continue
- loader = finder.find_module(fullname)
- if loader:
- return loader
+ if finder:
+ loader = finder.find_module(fullname)
+ if loader:
+ return loader
else:
return None