From e8f1068684236e5805e511b9abfd83888f05a1f9 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Wed, 22 Sep 2021 09:59:43 -0400 Subject: Add BinaryView.length and deprecate BinaryView.__len__ addresses binaryninja-api#2081 --- python/binaryview.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'python') 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"" 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): -- cgit v1.3.1