From: Guido van Rossum Date: Mon, 16 Apr 2001 18:12:04 +0000 (+0000) Subject: In walk(), don't die when os.lstat() raises os.error, e.g. because a X-Git-Tag: v2.1~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a490d5856dc0bcfbb286feb76dbc5e7a4edddef8;p=thirdparty%2FPython%2Fcpython.git 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! --- diff --git a/Lib/posixpath.py b/Lib/posixpath.py index 223d6ba32293..6bf40f8336e5 100644 --- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -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)