summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-04-16 18:12:04 (GMT)
committerGuido van Rossum <guido@python.org>2001-04-16 18:12:04 (GMT)
commita490d5856dc0bcfbb286feb76dbc5e7a4edddef8 (patch)
tree1e8e59d03227e95fa3ce1275e0fbfe272e146986 /Lib
parent95f301fa277b62c2e2a0a7d513c77c7349bc289b (diff)
downloadcpython-a490d5856dc0bcfbb286feb76dbc5e7a4edddef8.zip
cpython-a490d5856dc0bcfbb286feb76dbc5e7a4edddef8.tar.gz
cpython-a490d5856dc0bcfbb286feb76dbc5e7a4edddef8.tar.bz2
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!
Diffstat (limited to 'Lib')
-rw-r--r--Lib/posixpath.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index 223d6ba..6bf40f8 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)