NamedInt: return False on comparison with None

This commit is contained in:
FiveYellowMice 2023-10-16 00:44:20 +11:00 committed by Peter F. Patel-Schneider
parent 7706882a27
commit 636bb07d1f
1 changed files with 2 additions and 0 deletions

View File

@ -44,6 +44,8 @@ class NamedInt(int):
return int2bytes(self, count)
def __eq__(self, other):
if other is None:
return False
if isinstance(other, NamedInt):
return int(self) == int(other) and self.name == other.name
if isinstance(other, int):