From 0ab559ff898a416ea43ffd557981b4082dffb0c6 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Sat, 2 Apr 2022 09:09:06 -0400 Subject: Add __hash__ for Type/TypeBuilder --- python/types.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'python') diff --git a/python/types.py b/python/types.py index 418c4e4f..f87cc37f 100644 --- a/python/types.py +++ b/python/types.py @@ -510,6 +510,9 @@ class TypeBuilder: def handle(self) -> core.BNTypeHandle: return self.immutable_copy().handle + def __hash__(self): + return hash(ctypes.addressof(self.handle.contents)) + def _to_core_struct(self) -> core.BNTypeWithConfidence: type_conf = core.BNTypeWithConfidence() type_conf.type = self.handle @@ -1544,6 +1547,9 @@ class Type: return NotImplemented return core.BNTypesNotEqual(self._handle, other._handle) + def __hash__(self): + return hash(ctypes.addressof(self.handle.contents)) + @property def handle(self): return self._handle -- cgit v1.3.1