Skip to content

Commit 71cadf4

Browse files
small fix
1 parent 76d8a0c commit 71cadf4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pytools/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,8 @@ def __setstate__(self, valuedict: Dict[str, Any]) -> None:
485485
def __eq__(self, other: Any) -> bool:
486486
if self is other:
487487
return True
488+
if not isinstance(other, Record):
489+
return False
488490
return (self.__class__ == other.__class__
489491
and self.__getstate__() == other.__getstate__())
490492

@@ -505,8 +507,8 @@ def __hash__(self) -> int:
505507
(type(self),) + tuple(getattr(self, field)
506508
for field in self.__class__.fields))
507509

508-
assert self._cached_hash
509-
return self._cached_hash
510+
from typing import cast
511+
return cast(int, self._cached_hash)
510512

511513

512514
class ImmutableRecord(ImmutableRecordWithoutPickling, Record):

0 commit comments

Comments
 (0)