]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-125413: pathlib ABCs: use `scandir()` to speed up `glob()` (#126261)
authorBarney Gale <barney.gale@gmail.com>
Fri, 1 Nov 2024 17:48:58 +0000 (17:48 +0000)
committerGitHub <noreply@github.com>
Fri, 1 Nov 2024 17:48:58 +0000 (17:48 +0000)
commit68a51e0178e86be8b697683fd108aa795f235507
tree5da4b56ce369b38bc7e8398c74a050dd36da105b
parent464a7a91d0c75241a2f1913e78dbfbc29d4193b4
GH-125413: pathlib ABCs: use `scandir()` to speed up `glob()` (#126261)

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

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