8000 GH-112906: Fix performance regression in pathlib path initialisation … · python/cpython@23df46a · GitHub
[go: up one dir, main page]

Skip to content

Commit 23df46a

Browse files
GH-112906: Fix performance regression in pathlib path initialisation (#112907)
This was caused by 76929fd, specifically its use of `super()` and its packing/unpacking `*args`. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parent 96f64a2 commit 23df46a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/pathlib/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ def __init__(self, *args):
9090
"object where __fspath__ returns a str, "
9191
f"not {type(path).__name__!r}")
9292
paths.append(path)
93-
super().__init__(*paths)
93+
# Avoid calling super().__init__, as an optimisation
94+
self._raw_paths = paths
95+
self._resolving = False
9496

9597
def __reduce__(self):
9698
# Using the parts tuple helps share interned path parts

0 commit comments

Comments
 (0)
0