]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-117727: Speed up `pathlib.Path.iterdir()` by using `os.scandir()` (#117728)
authorBarney Gale <barney.gale@gmail.com>
Fri, 12 Apr 2024 22:02:39 +0000 (23:02 +0100)
committerGitHub <noreply@github.com>
Fri, 12 Apr 2024 22:02:39 +0000 (22:02 +0000)
commit30f0643e36d2c9a5849c76ca0b27b748448d0567
tree65cede6194946ae5d5f55815c42b454eeabde038
parent0eb52f5f266d9e0a662f28a4d2dfef8c746cf96e
GH-117727: Speed up `pathlib.Path.iterdir()` by using `os.scandir()` (#117728)

Replace use of `os.listdir()` with `os.scandir()`. Forgo setting `_drv`,
`_root` and `_tail_cached`, as these usually aren't needed. Use
`os.DirEntry.path` to set `_str`.
Lib/pathlib/__init__.py
Misc/NEWS.d/next/Library/2024-04-10-21-30-37.gh-issue-117727.uAYNVS.rst [new file with mode: 0644]