Terry J. Reedy added the comment: Memoryview should definitely have the same slice tests as other sequence objects. Go ahead and check.
I believe slice clamping itself should now be done by slice.indices, not by each class. S.indices(len) -> (start, stop, stride) Assuming a sequence of length len, calculate the start and stop indices, and the stride length of the extended slice described by S. Out of bounds indices are clipped in a manner consistent with the handling of normal slices. It seems like this was written before it was normal for every slice to have a step (stride), defaulting to None/1. It definitely comes from 2.x, before __getslice__ was folded into __getitem__ I expect builtin 3.x sequence objects should all use something like the C equivalent of def __getitem__(self, ob): if type(ob) is slice: start, stop, stride = ob.indices(self.len) ... ---------- title: memoryview: no overflow on large slice values (start, stop, step) -> memoryview: test slick clamping _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21856> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com