summaryrefslogtreecommitdiffstats
path: root/Lib/struct.py
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2024-01-20 03:06:00 (GMT)
committerGitHub <noreply@github.com>2024-01-20 03:06:00 (GMT)
commit1e610fb05fa4ba61a759b68461f1a9aed07622fc (patch)
tree6844d00162d805f022f6f5b69ead966c04e32549 /Lib/struct.py
parent6313cdde58f34648a430d2830357c9d2a5b67b87 (diff)
downloadcpython-1e610fb05fa4ba61a759b68461f1a9aed07622fc.zip
cpython-1e610fb05fa4ba61a759b68461f1a9aed07622fc.tar.gz
cpython-1e610fb05fa4ba61a759b68461f1a9aed07622fc.tar.bz2
GH-113225: Speed up `pathlib.Path.walk(top_down=False)` (#113693)
Use `_make_child_entry()` rather than `_make_child_relpath()` to retrieve path objects for directories to visit. This saves the allocation of one path object per directory in user subclasses of `PathBase`, and avoids a second loop. This trick does not apply when walking top-down, because users can affect the walk by modifying *dirnames* in-place. A side effect of this change is that, in bottom-up mode, subdirectories of each directory are visited in reverse order, and that this order doesn't match that of the names in *dirnames*. I suspect this is fine as the order is arbitrary anyway.
Diffstat (limited to 'Lib/struct.py')
0 files changed, 0 insertions, 0 deletions