Visitar URL original
gh-89727: Fix os.walk RecursionError on deep trees by jonburdo · Pull Request #99803 · 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
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