Skip to content
Closed
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
Also undo reversals in os.fwalk()
  • Loading branch information
barneygale committed May 30, 2024
commit cfc60ceb3bddd04bdd90485c11c25765f18395ce
6 changes: 4 additions & 2 deletions Lib/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,13 +553,15 @@ def _fwalk(stack, isbytes, topdown, onerror, follow_symlinks):

toppath = path.join(toppath, toppath[:0]) # Add trailing slash.
if entries is None:
if topdown:
dirs = dirs[::-1]
stack.extend(
(_fwalk_walk, (False, topfd, toppath + name, name, None))
for name in dirs[::-1])
for name in dirs)
else:
stack.extend(
(_fwalk_walk, (False, topfd, toppath + name, name, entry))
for name, entry in zip(dirs[::-1], entries[::-1]))
for name, entry in zip(dirs, entries))

__all__.append("fwalk")

Expand Down