Skip to content

GH-112855: Speed up pathlib.PurePath pickling #112856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 1 addition & 3 deletions Lib/pathlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ def __rtruediv__(self, key):
return NotImplemented

def __reduce__(self):
# Using the parts tuple helps share interned path parts
# when pickling related paths.
return (self.__class__, self.parts)
return self.__class__, tuple(self._raw_paths)

def __repr__(self):
return "{}({!r})".format(self.__class__.__name__, self.as_posix())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Speed up pickling of :class:`pathlib.PurePath` objects. Patch by Barney
Gale.