From 03528022aa2e1376a872058051009c5ee84df855 Mon Sep 17 00:00:00 2001 From: eamanu Date: Wed, 20 Feb 2019 21:48:23 -0300 Subject: [PATCH 1/2] bpo-36035: pathlib.Path().rglob() breaks with broken symlinks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on Jörg Stucke suggestion --- Lib/pathlib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 911b774b5649846..fae2e4c71ea627b 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -7,7 +7,7 @@ import re import sys from _collections_abc import Sequence -from errno import EINVAL, ENOENT, ENOTDIR, EBADF +from errno import EINVAL, ENOENT, ENOTDIR, EBADF, ELOOP from operator import attrgetter from stat import S_ISDIR, S_ISLNK, S_ISREG, S_ISSOCK, S_ISBLK, S_ISCHR, S_ISFIFO from urllib.parse import quote_from_bytes as urlquote_from_bytes @@ -35,7 +35,7 @@ # # EBADF - guard agains macOS `stat` throwing EBADF -_IGNORED_ERROS = (ENOENT, ENOTDIR, EBADF) +_IGNORED_ERROS = (ENOENT, ENOTDIR, EBADF, ELOOP) _IGNORED_WINERRORS = ( 21, # ERROR_NOT_READY - drive exists but is not accessible From 3cc8c8c9482c6e35ee6f4fe7244ddaa4b64dcfdc Mon Sep 17 00:00:00 2001 From: eamanu Date: Wed, 20 Feb 2019 22:04:33 -0300 Subject: [PATCH 2/2] add news file --- .../next/Library/2019-02-20-22-04-20.bpo-36035.zJ0TEX.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2019-02-20-22-04-20.bpo-36035.zJ0TEX.rst diff --git a/Misc/NEWS.d/next/Library/2019-02-20-22-04-20.bpo-36035.zJ0TEX.rst b/Misc/NEWS.d/next/Library/2019-02-20-22-04-20.bpo-36035.zJ0TEX.rst new file mode 100644 index 000000000000000..daf8c4883d6f4d6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-02-20-22-04-20.bpo-36035.zJ0TEX.rst @@ -0,0 +1,2 @@ +Ignoring ELOOP error on pathlib to avoid raise exceptions when symlinks are +broken.