This commit is contained in:
Nadeshiko Manju 2025-12-23 17:54:23 +09:00 committed by GitHub
commit 39519030bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -210,7 +210,12 @@ class PurePath:
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):

View file

@ -0,0 +1 @@
Avoid useless join operation when calculate the hash vaule for pathlib.Path.