]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-125413: pathlib ABCs: use `scandir()` to speed up `walk()` (#126262)
authorBarney Gale <barney.gale@gmail.com>
Fri, 1 Nov 2024 18:52:00 +0000 (18:52 +0000)
committerGitHub <noreply@github.com>
Fri, 1 Nov 2024 18:52:00 +0000 (18:52 +0000)
commit37651cfbce514a8daed75a8c63d6889081a63a23
tree285d6f2640767f8182ef86f8b642268699f91744
parent68a51e0178e86be8b697683fd108aa795f235507
GH-125413: pathlib ABCs: use `scandir()` to speed up `walk()` (#126262)

Use the new `PathBase.scandir()` method in `PathBase.walk()`, which greatly
reduces the number of `PathBase.stat()` calls needed when walking.

There are no user-facing changes, because the pathlib ABCs are still
private and `Path.walk()` doesn't use the implementation in its superclass.
Lib/pathlib/_abc.py
Lib/test/test_pathlib/test_pathlib_abc.py