mirror of
https://github.com/python/cpython.git
synced 2025-09-02 06:57:58 +00:00
[3.11] GH-87695: Fix OSError from pathlib.Path.glob()
(GH-104292) (GH-104362)
Fix issue where `pathlib.Path.glob()` raised `OSError` when it encountered
a symlink to an overly long path.
(cherry picked from commit a33ce66dca
)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
This commit is contained in:
parent
1cbf844875
commit
846a23d0b8
3 changed files with 13 additions and 2 deletions
|
@ -388,11 +388,11 @@ class _RecursiveWildcardSelector(_Selector):
|
|||
for entry in entries:
|
||||
entry_is_dir = False
|
||||
try:
|
||||
entry_is_dir = entry.is_dir()
|
||||
entry_is_dir = entry.is_dir(follow_symlinks=False)
|
||||
except OSError as e:
|
||||
if not _ignore_error(e):
|
||||
raise
|
||||
if entry_is_dir and not entry.is_symlink():
|
||||
if entry_is_dir:
|
||||
path = parent_path._make_child_relpath(entry.name)
|
||||
for p in self._iterate_directories(path, is_dir, scandir):
|
||||
yield p
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue