]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Actually remove directories from sys.path if they do not exist; the intent
authorFred Drake <fdrake@acm.org>
Thu, 12 Jul 2001 21:08:33 +0000 (21:08 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 12 Jul 2001 21:08:33 +0000 (21:08 +0000)
is to avoid as many stat() calls as we can.

Lib/site.py

index 16540f6255a08813ee2564e8ca9ff2ad30a9f756..7848553122f3866ac79a6cba27f40df9e508d6f9 100644 (file)
@@ -79,6 +79,10 @@ del m
 L = []
 dirs_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)
     if not dirs_in_sys_path.has_key(dircase):
         L.append(dir)