GH-89727: Fix os.fwalk() recursion error on deep trees#119638
GH-89727: Fix os.fwalk() recursion error on deep trees#119638barneygale merged 9 commits intopython:mainfrom
os.fwalk() recursion error on deep trees#119638Conversation
Implement `os.fwalk()` using a list as a stack to avoid emitting recursion errors on deeply nested trees.
|
Ready for review! I fixed the test failure mentioned above by reversing the |
carljm
left a comment
There was a problem hiding this comment.
I won't claim I did a line-by-line verification of equivalence with the current code, but I walked through the new code and it looks sensible, and the existing test coverage looks reasonable.
Did you consider adding a test that sets a very low recursion limit and verifies we don't hit it? I don't feel strongly about this.
I've enabled |
No, that looks fine. Sorry, somehow I just totally missed that one-line removal when focused on the "added lines" side of the diff! |
|
No worries, thanks tons for the speedy review :) |
|
Thanks @barneygale for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…nGH-119638) Implement `os.fwalk()` using a list as a stack to avoid emitting recursion errors on deeply nested trees. (cherry picked from commit 3c890b5) Co-authored-by: Barney Gale <barney.gale@gmail.com>
…nGH-119638) Implement `os.fwalk()` using a list as a stack to avoid emitting recursion errors on deeply nested trees. (cherry picked from commit 3c890b5) Co-authored-by: Barney Gale <barney.gale@gmail.com>
|
GH-119764 is a backport of this pull request to the 3.13 branch. |
|
GH-119765 is a backport of this pull request to the 3.12 branch. |
…n#119638) Implement `os.fwalk()` using a list as a stack to avoid emitting recursion errors on deeply nested trees.
…n#119638) Implement `os.fwalk()` using a list as a stack to avoid emitting recursion errors on deeply nested trees.

Implement
os.fwalk()using a list as a stack to avoid emitting recursion errors on deeply nested trees.