Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 84a7459

Browse files
committed
Patch by Gerrit Holl to avoid doing two stat() calls in a row in walk().
1 parent 0ba3300 commit 84a7459

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/posixpath.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ def walk(top, func, arg):
267267
for name in names:
268268
if name not in exceptions:
269269
name = join(top, name)
270-
if isdir(name) and not islink(name):
270+
st = os.lstat(name)
271+
if stat.S_ISDIR(st[stat.ST_MODE]):
271272
walk(name, func, arg)
272273

273274

0 commit comments

Comments
 (0)