Commit fd4ff52c authored by Fred Drake's avatar Fred Drake

Actually remove directories from sys.path if they do not exist; the intent

is to avoid as many stat() calls as we can.
parent 9b23920b
...@@ -79,6 +79,10 @@ del m ...@@ -79,6 +79,10 @@ del m
L = [] L = []
dirs_in_sys_path = {} dirs_in_sys_path = {}
for dir in sys.path: for dir in sys.path:
# Filter out paths that don't exist, but leave in the empty string
# since it's a special case.
if dir and not os.path.isdir(dir):
continue
dir, dircase = makepath(dir) dir, dircase = makepath(dir)
if not dirs_in_sys_path.has_key(dircase): if not dirs_in_sys_path.has_key(dircase):
L.append(dir) L.append(dir)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment