summaryrefslogtreecommitdiff
path: root/python/types.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2022-04-02 09:09:06 -0400
committerPeter LaFosse <peter@vector35.com>2022-04-08 08:57:02 -0400
commit0ab559ff898a416ea43ffd557981b4082dffb0c6 (patch)
tree6cdc570ede76a962b91f3fdaf9e372891ac9aeff /python/types.py
parent89b779d480225665b71d2675b52a8e04d1478cb7 (diff)
Add __hash__ for Type/TypeBuilder
Diffstat (limited to 'python/types.py')
-rw-r--r--python/types.py6
1 files changed, 6 insertions, 0 deletions
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