Patch by Gerrit Holl to avoid doing two stat() calls in a row in walk().
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index 792a985..cc0e4cb 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -267,7 +267,8 @@
     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)