]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
In walk(), don't die when os.lstat() raises os.error, e.g. because a
authorGuido van Rossum <guido@python.org>
Mon, 16 Apr 2001 18:12:04 +0000 (18:12 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 16 Apr 2001 18:12:04 +0000 (18:12 +0000)
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!

Lib/posixpath.py

index 223d6ba3229382d12ee546b78a4e4ff57eb3a9f2..6bf40f8336e56488739b0501fa08a009ef64bce0 100644 (file)
@@ -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)