Unfortunately, stat.st_ino returns 0 on Windows, at least on Python 2.7, so we can't use that way of telling when we're seeing the same directory again. Surely the real pathname should work.

(cherry picked from commit 9d8dfe934b)
This commit is contained in:
Richard Kimberly Heck 2020-02-24 19:00:31 -05:00
parent 4150011e1e
commit fb9bc1a3f7

View File

@ -121,10 +121,11 @@ for type in types:
# prevent inifinite recursion
recurse = []
for dir in dirs:
st = os.stat(os.path.join(root, dir))
key = st.st_dev, st.st_ino
if key not in visited:
visited.add(key)
dirname = os.path.join(root, dir)
dirname = os.path.realpath(dirname)
dirname = os.path.normcase(dirname)
if dirname not in visited:
visited.add(dirname)
recurse.append(dir)
dirs[:] = recurse
# check file type