]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-89727: Fix pathlib.Path.walk RecursionError on deep trees (GH-100282)
authorStanislav Zmiev <szmiev2000@gmail.com>
Wed, 22 Mar 2023 14:45:25 +0000 (18:45 +0400)
committerGitHub <noreply@github.com>
Wed, 22 Mar 2023 14:45:25 +0000 (14:45 +0000)
commit713df2c53489ce8012d0ede10b70950e6b0d8372
tree8ef14b4352a308817169ae77533537b958aedef4
parentaf9c34f6ef8dceb21871206eb3e4d350f6e3d3dc
GH-89727: Fix pathlib.Path.walk RecursionError on deep trees (GH-100282)

Use a stack to implement `pathlib.Path.walk()` iteratively instead of recursively to avoid hitting recursion limits on deeply nested trees.

Co-authored-by: Barney Gale <barney.gale@gmail.com>
Co-authored-by: Brett Cannon <brett@python.org>
Lib/pathlib.py
Lib/test/test_pathlib.py
Misc/NEWS.d/next/Library/2022-12-16-10-27-58.gh-issue-89727.y64ZLM.rst [new file with mode: 0644]