summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2024-01-27 19:59:51 (GMT)
committerGitHub <noreply@github.com>2024-01-27 19:59:51 (GMT)
commit823a38a960c245cbf309ef29120d3690ba1bcd2c (patch)
tree71d67154b8df245aa6256a2fb45a20254f743048 /Lib/pathlib
parent7a470541e2bbc6f3e87a6d813e2ec42cf726de7a (diff)
downloadcpython-823a38a960c245cbf309ef29120d3690ba1bcd2c.zip
cpython-823a38a960c245cbf309ef29120d3690ba1bcd2c.tar.gz
cpython-823a38a960c245cbf309ef29120d3690ba1bcd2c.tar.bz2
GH-79634: Speed up pathlib globbing by removing `joinpath()` call. (#114623)
Remove `self.joinpath('')` call that should have been removed in 6313cdde. This makes `PathBase.glob('')` yield itself *without* adding a trailing slash. It's hard to say whether this is more or less correct, but at least everything else is faster, and there's no behaviour change in the public classes where empty glob patterns are disallowed.
Diffstat (limited to 'Lib/pathlib')
-rw-r--r--Lib/pathlib/_abc.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/pathlib/_abc.py b/Lib/pathlib/_abc.py
index 6303a18..ad56848 100644
--- a/Lib/pathlib/_abc.py
+++ b/Lib/pathlib/_abc.py
@@ -771,7 +771,7 @@ class PathBase(PurePathBase):
filter_paths = False
deduplicate_paths = False
sep = self.pathmod.sep
- paths = iter([self.joinpath('')] if self.is_dir() else [])
+ paths = iter([self] if self.is_dir() else [])
while stack:
part = stack.pop()
if part in specials: