summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/types.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/python/types.py b/python/types.py
index 94e1f42d..92735fc6 100644
--- a/python/types.py
+++ b/python/types.py
@@ -548,13 +548,26 @@ class Type(object):
@property
def can_return(self):
- """Whether type can return (read-only)"""
+ """Whether type can return"""
if self._mutable:
result = core.BNFunctionTypeBuilderCanReturn(self._handle)
else:
result = core.BNFunctionTypeCanReturn(self._handle)
return BoolWithConfidence(result.value, confidence = result.confidence)
+ @can_return.setter
+ def can_return(self, value):
+ """Whether type can return (read-only)"""
+ if not self._mutable:
+ raise AttributeError("Finalized Type object is immutable, use mutable_copy()")
+ bc = core.BNBoolWithConfidence()
+ bc.value = bool(value)
+ if hasattr(value, 'confidence'):
+ bc.confidence = value.confidence
+ else:
+ bc.confidence = max_confidence
+ core.BNSetFunctionTypeBuilderCanReturn(self._handle, bc)
+
@property
def structure(self):
"""Structure of the type (read-only)"""