10000 gh-89727: Fix os.walk RecursionError on deep trees by jonburdo · Pull Request #99803 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-89727: Fix os.walk RecursionError on deep trees #99803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Dec 19, 2022
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
move deque import inside os.walk
  • Loading branch information
jonburdo committed Dec 16, 2022
commit ef46eda965d1c8dc1a63dbf464a79ab19fc8d80d
3 changes: 2 additions & 1 deletion Lib/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#'
import abc
from collections import deque
import sys
import stat as st

Expand Down Expand Up @@ -342,6 +341,8 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
"""
sys.audit("os.walk", top, topdown, onerror, followlinks)

from collections import deque

stack = deque([(False, fspath(top))])
while stack:
must_yield, top = stack.pop()
Expand Down
0