mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
Actually remove directories from sys.path if they do not exist; the intent
is to avoid as many stat() calls as we can.
This commit is contained in:
parent
9b23920b0f
commit
fd4ff52c22
1 changed files with 4 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue