Skip to content

Commit

Permalink
pythonGH-112906: Fix performance regression in pathlib path initialis…
Browse files Browse the repository at this point in the history
…ation (python#112907)

This was caused by 76929fd, specifically its use of `super()` and its
packing/unpacking `*args`.

Co-authored-by: Alex Waygood <[email protected]>
  • Loading branch information
barneygale and AlexWaygood authored Dec 10, 2023
1 parent 96f64a2 commit 23df46a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Lib/pathlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 23df46a

Please sign in to comment.