Issue #28353: os.fwalk() no longer fails on broken links.

This commit is contained in:
Serhiy Storchaka 2016-10-25 14:34:38 +03:00
commit af4e4747f5
3 changed files with 22 additions and 4 deletions

View file

@ -481,13 +481,13 @@ if {open, stat} <= supports_dir_fd and {listdir, stat} <= supports_fd:
dirs.append(name)
else:
nondirs.append(name)
except FileNotFoundError:
except OSError:
try:
# Add dangling symlinks, ignore disappeared files
if st.S_ISLNK(stat(name, dir_fd=topfd, follow_symlinks=False)
.st_mode):
nondirs.append(name)
except FileNotFoundError:
except OSError:
continue
if topdown: