Do not crash when failing to read an entry (#1090)

This commit is contained in:
Tzu-ping Chung 2019-10-25 05:19:13 +08:00 committed by Jelle Zijlstra
parent 8ea13474a6
commit 4c4a51cb6b

View File

@ -3491,6 +3491,9 @@ def gen_python_files_in_dir(
# Then ignore with `exclude` option.
try:
normalized_path = "/" + child.resolve().relative_to(root).as_posix()
except OSError as e:
report.path_ignored(child, f"cannot be read because {e}")
continue
except ValueError:
if child.is_symlink():
report.path_ignored(