Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into gh-77609-glob-follow-symlinks
  • Loading branch information
barneygale committed May 11, 2023
commit 6c61822c9c5ea7c14bacf37d8776482a62f64ada
19 changes: 6 additions & 13 deletions Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ def _select_from(self, parent_path, scandir, follow_symlinks):
for entry in entries:
if self.dironly:
try:
# "entry.is_dir()" can raise PermissionError
# in some cases (see bpo-38894), which is not
# among the errors ignored by _ignore_error()
if not entry.is_dir(follow_symlinks=follow_dirlinks):
continue
except OSError:
Expand Down Expand Up @@ -182,23 +179,19 @@ def _iterate_directories(self, parent_path, scandir, follow_symlinks):
entry_is_dir = False
try:
entry_is_dir = entry.is_dir(follow_symlinks=follow_symlinks)
except OSError as e:
if not _ignore_error(e):
raise
except OSError:
pass
if entry_is_dir:
path = parent_path._make_child_relpath(entry.name)
for p in self._iterate_directories(path, scandir, follow_symlinks):
yield p

def _select_from(self, parent_path, scandir, follow_symlinks):
follow_dirlinks = False if follow_symlinks is None else follow_symlinks
try:
successor_select = self.successor._select_from
for starting_point in self._iterate_directories(parent_path, scandir, follow_dirlinks):
for p in successor_select(starting_point, scandir, follow_symlinks):
yield p
except PermissionError:
return
successor_select = self.successor._select_from
for starting_point in self._iterate_directories(parent_path, scandir, follow_dirlinks):
for p in successor_select(starting_point, scandir, follow_symlinks):
yield p


class _DoubleRecursiveWildcardSelector(_RecursiveWildcardSelector):
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.