From 84a74595f784c5a6f8138bed0235a5b86d175edb Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 28 Feb 2000 14:27:07 +0000 Subject: [PATCH] Patch by Gerrit Holl to avoid doing two stat() calls in a row in walk(). --- Lib/posixpath.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/posixpath.py b/Lib/posixpath.py index 792a9856d5d..cc0e4cba1ff 100644 --- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -267,7 +267,8 @@ def walk(top, func, arg): for name in names: if name not in exceptions: name = join(top, name) - if isdir(name) and not islink(name): + st = os.lstat(name) + if stat.S_ISDIR(st[stat.ST_MODE]): walk(name, func, arg)