Visitar URL original
GH-101362: Optimise pathlib by deferring path normalisation by barneygale · Pull Request #101560 · python/cpython · GitHub
Skip to content
Closed
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
Fix pickling of paths created via walking.
  • Loading branch information
barneygale committed Mar 6, 2023
commit cbf0fcd2890f3a0ce66bca91b8027d3432212f03
4 changes: 3 additions & 1 deletion Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ def __new__(cls, *args):
return cls._from_parts(args)

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

@classmethod
def _join_parts(cls, parts):
Expand Down