From 167ced17956bbb79aee3a6e6ef88079d822427cb Mon Sep 17 00:00:00 2001 From: Chinmay Date: Wed, 9 Sep 2020 22:17:15 -0700 Subject: Update API name for ParsePossibleValueSet --- python/binaryview.py | 10 +++++----- python/function.py | 10 ++++++---- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'python') diff --git a/python/binaryview.py b/python/binaryview.py index 39af851c..49a80a4a 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -4677,7 +4677,7 @@ class BinaryView(object): core.BNFreeTypeParserResult(parse) return types.TypeParserResult(type_dict, variables, functions) - def parse_possiblevalueset_string(self, value, state, here=0): + def parse_possiblevalueset(self, value, state, here=0): r""" Evaluates a string representation of a PossibleValueSet into an instance of the ``PossibleValueSet`` value. @@ -4698,20 +4698,20 @@ class BinaryView(object): :rtype: PossibleValueSet :Example: - >>> psv_c = bv.parse_possiblevalueset_string("400", RegisterValueType.ConstantValue) + >>> psv_c = bv.parse_possiblevalueset("400", RegisterValueType.ConstantValue) >>> psv_c - >>> psv_ur = bv.parse_possiblevalueset_string("1:10:1", RegisterValueType.UnsignedRangeValue) + >>> psv_ur = bv.parse_possiblevalueset("1:10:1", RegisterValueType.UnsignedRangeValue) >>> psv_ur ]> - >>> psv_is = bv.parse_possiblevalueset_string("1,2,3", RegisterValueType.InSetOfValues) + >>> psv_is = bv.parse_possiblevalueset("1,2,3", RegisterValueType.InSetOfValues) >>> psv_is >>> """ result = core.BNPossibleValueSet(); errors = ctypes.c_char_p(); - if not core.BNParsePossibleValueSetString(self.handle, value, state, result, here, errors): + if not core.BNParsePossibleValueSet(self.handle, value, state, result, here, errors): if errors: error_str = errors.value.decode("utf-8") else: diff --git a/python/function.py b/python/function.py index 44c2f383..bf5afb87 100644 --- a/python/function.py +++ b/python/function.py @@ -382,13 +382,15 @@ class PossibleValueSet(object): def __eq__(self, other): if self.type in [RegisterValueType.ConstantValue, RegisterValueType.ConstantPointerValue] and isinstance(other, numbers.Integral): return self.value == other - if self.type in [RegisterValueType.ConstantValue, RegisterValueType.ConstantPointerValue] and hasattr(other, 'type') and other.type == self.type: + if not isinstance(other, self.__class__): + return NotImplemented + if self.type in [RegisterValueType.ConstantValue, RegisterValueType.ConstantPointerValue]: return self.value == other.value - elif self.type == RegisterValueType.StackFrameOffset and hasattr(other, 'type') and other.type == self.type: + elif self.type == RegisterValueType.StackFrameOffset: return self.offset == other.offset - elif self.type in [RegisterValueType.SignedRangeValue, RegisterValueType.UnsignedRangeValue] and hasattr(other, 'type') and other.type == self.type: + elif self.type in [RegisterValueType.SignedRangeValue, RegisterValueType.UnsignedRangeValue]: return self.ranges == other.ranges - elif self.type in [RegisterValueType.InSetOfValues, RegisterValueType.NotInSetOfValues] and hasattr(other, 'type') and other.type == self.type: + elif self.type in [RegisterValueType.InSetOfValues, RegisterValueType.NotInSetOfValues]: return self.values == other.values elif self.type == RegisterValueType.UndeterminedValue and hasattr(other, 'type'): return self.type == other.type -- cgit v1.3.1