Visitar URL original
GH-76846, GH-85281: Call `__new__()` and `__init__()` on pathlib subclasses by barneygale · Pull Request #102789 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make pickling cheaper
  • Loading branch information
barneygale committed Mar 19, 2023
commit 32d13ba8ef60156328bf0015c37cfe8a3e74615d
2 changes: 1 addition & 1 deletion Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def __new__(cls, *args, **kwargs):
def __reduce__(self):
# Using the parts tuple helps share interned path parts
# when pickling related paths.
return (self.__class__, self.parts)
return (self.__class__, (self._raw_path,))

def __init__(self, *args):
if not args:
Expand Down