summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2023-12-10 00:06:27 (GMT)
committerGitHub <noreply@github.com>2023-12-10 00:06:27 (GMT)
commit23df46a1dde82bc5a51578d9443024cf85827b95 (patch)
tree8127655e67c6f7eb4ea8750685465c43efd0d026 /Lib/pathlib
parent96f64a2b1b4e3d4902848c63e42717a9c5539e03 (diff)
downloadcpython-23df46a1dde82bc5a51578d9443024cf85827b95.zip
cpython-23df46a1dde82bc5a51578d9443024cf85827b95.tar.gz
cpython-23df46a1dde82bc5a51578d9443024cf85827b95.tar.bz2
GH-112906: Fix performance regression in pathlib path initialisation (#112907)
This was caused by 76929fdeeb, specifically its use of `super()` and its packing/unpacking `*args`. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Lib/pathlib')
-rw-r--r--Lib/pathlib/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/pathlib/__init__.py b/Lib/pathlib/__init__.py
index f4668ab..b020d2d 100644
--- a/Lib/pathlib/__init__.py
+++ b/Lib/pathlib/__init__.py
@@ -90,7 +90,9 @@ class PurePath(_abc.PurePathBase):
"object where __fspath__ returns a str, "
f"not {type(path).__name__!r}")
paths.append(path)
- super().__init__(*paths)
+ # Avoid calling super().__init__, as an optimisation
+ self._raw_paths = paths
+ self._resolving = False
def __reduce__(self):
# Using the parts tuple helps share interned path parts