mirror of
https://github.com/python/cpython.git
synced 2025-08-28 12:45:07 +00:00
In walk(), don't die when os.lstat() raises os.error, e.g. because a
file was deleted by a previous call to the visitor function. This used to be the behavior in 1.5.2 and before, but a patch to avoid making two stat() calls accidentally broke this in 2.0. Moshe, this would be a good one for 2.0.1 too!
This commit is contained in:
parent
95f301fa27
commit
a490d5856d
1 changed files with 4 additions and 1 deletions
|
@ -269,7 +269,10 @@ def walk(top, func, arg):
|
|||
func(arg, top, names)
|
||||
for name in names:
|
||||
name = join(top, name)
|
||||
st = os.lstat(name)
|
||||
try:
|
||||
st = os.lstat(name)
|
||||
except os.error:
|
||||
continue
|
||||
if stat.S_ISDIR(st[stat.ST_MODE]):
|
||||
walk(name, func, arg)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue