Skip to content
Open
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
7 changes: 6 additions & 1 deletion Lib/pathlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@ def __hash__(self):
try:
return self._hash
except AttributeError:
self._hash = hash(self._str_normcase)
if self.parser is posixpath:
self._hash = hash((self.root, tuple(self._tail)))
else:
self._hash = hash((self.drive.lower(),
self.root.lower(),
tuple([part.lower() for part in self._tail])))
return self._hash

def __eq__(self, other):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid useless join operation when calculate the hash vaule for pathlib.Path.
Loading