diff options
author | Fred Drake <fdrake@acm.org> | 2001-07-12 21:08:33 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-07-12 21:08:33 (GMT) |
commit | fd4ff52c2200078a6f55d85901c46fee83b1d420 (patch) | |
tree | c56f042b5f540b51d5ca5430147838d3194d6005 /Lib/site.py | |
parent | 9b23920b0f2446113f307ce31afd06c6988017cc (diff) | |
download | cpython-fd4ff52c2200078a6f55d85901c46fee83b1d420.zip cpython-fd4ff52c2200078a6f55d85901c46fee83b1d420.tar.gz cpython-fd4ff52c2200078a6f55d85901c46fee83b1d420.tar.bz2 |
Actually remove directories from sys.path if they do not exist; the intent
is to avoid as many stat() calls as we can.
Diffstat (limited to 'Lib/site.py')
-rw-r--r-- | Lib/site.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/site.py b/Lib/site.py index 16540f6..7848553 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -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) |