diff options
| author | 3rdit <llerdit@gmail.com> | 2026-01-22 21:09:28 +0000 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2026-02-16 16:21:22 -0500 |
| commit | da19d7e633872ad1c4ba5155e714062ba5c8e5ae (patch) | |
| tree | 5bc3e96fcc16fa8c122c329e460e7d35127bf4ea /python/binaryview.py | |
| parent | 157045084b8938d02811f100f7b236685472658c (diff) | |
Fix TypeError when slicing FunctionList/BasicBlockList with [:], [n:], [:n]
Diffstat (limited to 'python/binaryview.py')
| -rw-r--r-- | python/binaryview.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index 2f441f34..8a93b3cc 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -2466,10 +2466,8 @@ class FunctionList: return _function.Function(self._view, core.BNNewFunctionReference(self._funcs[i])) elif isinstance(i, slice): result = [] - if i.start < 0 or i.start >= len(self) or i.stop < 0 or i.stop >= len(self): - raise IndexError(f"Slice {i} out of bounds for FunctionList of size {len(self)}") - - for j in range(i.start, i.stop, i.step if i.step is not None else 1): + start, stop, step = i.indices(len(self)) + for j in range(start, stop, step): result.append(_function.Function(self._view, core.BNNewFunctionReference(self._funcs[j]))) return result raise ValueError("FunctionList.__getitem__ supports argument of type integer or slice") |
