diff options
| author | Peter LaFosse <peter@vector35.com> | 2022-05-24 16:07:29 -0400 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2022-05-25 18:09:56 -0400 |
| commit | 7a564e6cce1b82b79140cb145a20f46fd58ca99f (patch) | |
| tree | cf3e76dd5f7321b5b59c210cf54851a5728b67f0 /python/binaryview.py | |
| parent | 0569365d79aaeb74aa134f52db13aa54f9619c56 (diff) | |
Fix binaryview __getitem__ __setitem__ and add many additional BinaryView unit tests
Diffstat (limited to 'python/binaryview.py')
| -rw-r--r-- | python/binaryview.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index 9093bcda..966c164b 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -1865,7 +1865,7 @@ class BinaryView: return self.read(start, stop - start) elif i < 0: if i >= -len(self): - value = self.read(int(len(self) + i), 1) + value = self.read(self.start + int(len(self) + i), 1) if len(value) == 0: raise IndexError("index not readable") return value @@ -1896,7 +1896,7 @@ class BinaryView: if i >= -len(self): if len(value) != 1: raise ValueError("expected single byte for assignment") - if self.write(int(len(self) + i), value) != 1: + if self.write(self.start + int(len(self) + i), value) != 1: raise IndexError("index not writable") else: raise IndexError("index out of range") |
