If self or other doesn't have a stamp, we regard these objects as unequal.

pull/691/head
jMyles 2019-01-26 19:55:17 -05:00
parent d20a4cc8ad
commit d6027c810a
1 changed files with 5 additions and 1 deletions

View File

@ -200,7 +200,11 @@ class Character(Learner):
self.known_nodes.record_fleet_state()
def __eq__(self, other) -> bool:
return bytes(self.stamp) == bytes(other.stamp)
try:
other_stamp = other.stamp
except (AttributeError, NoSigningPower):
return False
return bytes(self.stamp) == bytes(other_stamp)
def __hash__(self):
return int.from_bytes(bytes(self.stamp), byteorder="big")