summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2024-04-12 21:19:21 (GMT)
committerGitHub <noreply@github.com>2024-04-12 21:19:21 (GMT)
commit0eb52f5f266d9e0a662f28a4d2dfef8c746cf96e (patch)
tree2cccc9ca7a407f88e57b1bf1b7406a1c73005ce2 /Misc
parent069de14cb948f56b37e507f367b99c5563d3685e (diff)
downloadcpython-0eb52f5f266d9e0a662f28a4d2dfef8c746cf96e.zip
cpython-0eb52f5f266d9e0a662f28a4d2dfef8c746cf96e.tar.gz
cpython-0eb52f5f266d9e0a662f28a4d2dfef8c746cf96e.tar.bz2
GH-115060: Speed up `pathlib.Path.glob()` by not scanning literal parts (#117732)
Don't bother calling `os.scandir()` to scan for literal pattern segments, like `foo` in `foo/*.py`. Instead, append the segment(s) as-is and call through to the next selector with `exists=False`, which signals that the path might not exist. Subsequent selectors will call `os.scandir()` or `os.lstat()` to filter out missing paths as needed.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Library/2024-04-10-22-35-24.gh-issue-115060.XEVuOb.rst2
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2024-04-10-22-35-24.gh-issue-115060.XEVuOb.rst b/Misc/NEWS.d/next/Library/2024-04-10-22-35-24.gh-issue-115060.XEVuOb.rst
new file mode 100644
index 0000000..b5084a0
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-04-10-22-35-24.gh-issue-115060.XEVuOb.rst
@@ -0,0 +1,2 @@
+Speed up :meth:`pathlib.Path.glob` by not scanning directories for
+non-wildcard pattern segments.