This allows Function objects to be properly deduped when added to a set or dictionary. * Added __hash__ to Function. This allows Function objects to be properly deduped when added to a set or dictionary.
| -rw-r--r-- | python/function.py | 3 |
diff --git a/python/function.py b/python/function.py index 8beebe66..d06d604d 100644 --- a/python/function.py +++ b/python/function.py @@ -258,6 +258,9 @@ class Function(object): return True return ctypes.addressof(self.handle.contents) != ctypes.addressof(value.handle.contents) + def __hash__(self): + return hash((self.start, self.arch.name, self.platform.name)) + @classmethod def _unregister(cls, func): handle = ctypes.cast(func, ctypes.c_void_p) |