- Issue #16514: Fix regression causing a traceback when sys.path[0] is None

(actually, any non-string or non-bytes type).
This commit is contained in:
Barry Warsaw 2012-11-20 15:22:51 -05:00
parent 23089ab1db
commit 82c1c781c7
6 changed files with 111 additions and 77 deletions

View file

@ -1281,6 +1281,8 @@ class PathFinder:
# the list of paths that will become its __path__
namespace_path = []
for entry in path:
if not isinstance(entry, (str, bytes)):
continue
finder = cls._path_importer_cache(entry)
if finder is not None:
if hasattr(finder, 'find_loader'):