Skip to content

Commit a490d58

Browse files
committed
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!
1 parent 95f301f commit a490d58

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/posixpath.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,10 @@ def walk(top, func, arg):
269269
func(arg, top, names)
270270
for name in names:
271271
name = join(top, name)
272-
st = os.lstat(name)
272+
try:
273+
st = os.lstat(name)
274+
except os.error:
275+
continue
273276
if stat.S_ISDIR(st[stat.ST_MODE]):
274277
walk(name, func, arg)
275278

0 commit comments

Comments
 (0)