Visitar URL original
gh-89727: Fix pathlib.Path.walk RecursionError on deep trees by zmievsa · Pull Request #100282 · python/cpython · GitHub
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
Unify walk and _walk methods
  • Loading branch information
zmievsa committed Dec 15, 2022
commit f8968b647f07b7826c2d073d3007220f96bcef37
4 changes: 0 additions & 4 deletions Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,9 +1280,6 @@ def expanduser(self):
def walk(self, top_down=True, on_error=None, follow_symlinks=False):
"""Walk the directory tree from this directory, similar to os.walk()."""
sys.audit("pathlib.Path.walk", self, on_error, follow_symlinks)
return self._walk(top_down, on_error, follow_symlinks)

def _walk(self, top_down, on_error, follow_symlinks):
stack: ... = deque(((False, self),))

while stack:
Expand All @@ -1291,7 +1288,6 @@ def _walk(self, top_down, on_error, follow_symlinks):
yield top
continue


# We may not have read permission for self, in which case we can't
# get a list of the files the directory contains. os.walk
# always suppressed the exception then, rather than blow up for a
Expand Down