summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2021-09-22 09:59:43 -0400
committerPeter LaFosse <peter@vector35.com>2021-09-22 10:38:48 -0400
commite8f1068684236e5805e511b9abfd83888f05a1f9 (patch)
treebcb938b1c5e03de249aca83cface768d09dab799 /python
parent21069e7a00f7c7275ff9f15fcbc1532885d86e01 (diff)
Add BinaryView.length and deprecate BinaryView.__len__ addresses binaryninja-api#2081
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index b718dd6c..12f886fd 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -1408,6 +1408,13 @@ class BinaryView:
return f"<BinaryView: {size}>"
def __len__(self):
+ # deprecated - Python does allow the returning of integers >= 0x8000000000000000
+ # please use .length instead
+ # for more information about this limitation in python see https://bugs.python.org/issue21444
+ return int(core.BNGetViewLength(self.handle))
+
+ @property
+ def length(self):
return int(core.BNGetViewLength(self.handle))
def __eq__(self, other):