diff options
author | Barney Gale <barney.gale@gmail.com> | 2023-12-10 00:06:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-10 00:06:27 (GMT) |
commit | 23df46a1dde82bc5a51578d9443024cf85827b95 (patch) | |
tree | 8127655e67c6f7eb4ea8750685465c43efd0d026 /Lib/pathlib | |
parent | 96f64a2b1b4e3d4902848c63e42717a9c5539e03 (diff) | |
download | cpython-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__.py | 4 |
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 |