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>
This commit is contained in:
Barney Gale 2023-12-10 00:06:27 +00:00 committed by GitHub
parent 96f64a2b1b
commit 23df46a1dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,7 +90,9 @@ def __init__(self, *args):
"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