diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2020-03-16 21:38:29 -0400 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2020-03-16 21:38:29 -0400 |
| commit | b67f98d1e982b37ab80c32c019c5c221512e608e (patch) | |
| tree | 8f17aa31dd571f7113b7f9483cfa72c50f329d8d /python/architecture.py | |
| parent | 166a67bfa7f00549c7de23694edb22a9e776413f (diff) | |
add __lt__ to referencesource objects and raise exception if invalid type
Diffstat (limited to 'python/architecture.py')
| -rw-r--r-- | python/architecture.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/python/architecture.py b/python/architecture.py index b9001bf3..a6e1a083 100644 --- a/python/architecture.py +++ b/python/architecture.py @@ -2724,6 +2724,16 @@ class ReferenceSource(object): else: return "<ref: %#x>" % self._address + def __eq__(self, value): + if not isinstance(value, ReferenceSource): + return False + return self.function == value.function and self.arch == value.arch and self.address == value.address + + def __lt__(self, value): + if not isinstance(value, ReferenceSource): + raise TypeError("Can only compare to other ReferenceSource objects") + return self.address < value.address + @property def function(self): """ """ |
