Skip to content

Commit 8fde5f3

Browse files
committed
Make __getitem__ handle slice for Python 3
Python 3 doesn't have __getslice__ instead it uses __getitem__ with a slice object.
1 parent 04b2c8e commit 8fde5f3

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

smmap/buf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def __len__(self):
5151
return self._size
5252

5353
def __getitem__(self, i):
54+
if isinstance(i, slice):
55+
return self.__getslice__(i.start or 0, i.stop or self._size)
5456
c = self._c
5557
assert c.is_valid()
5658
if i < 0:

0 commit comments

Comments
 (0)