summaryrefslogtreecommitdiffstats
path: root/Modules/_testbuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_testbuffer.c')
-rw-r--r--Modules/_testbuffer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
index 43db8a8..0885a03 100644
--- a/Modules/_testbuffer.c
+++ b/Modules/_testbuffer.c
@@ -1714,10 +1714,10 @@ init_slice(Py_buffer *base, PyObject *key, int dim)
{
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx(key, base->shape[dim],
- &start, &stop, &step, &slicelength) < 0) {
+ if (PySlice_Unpack(key, &start, &stop, &step) < 0) {
return -1;
}
+ slicelength = PySlice_AdjustIndices(base->shape[dim], &start, &stop, step);
if (base->suboffsets == NULL || dim == 0) {
@@ -1934,9 +1934,10 @@ slice_indices(PyObject *self, PyObject *args)
"first argument must be a slice object");
return NULL;
}
- if (PySlice_GetIndicesEx(key, len, &s[0], &s[1], &s[2], &s[3]) < 0) {
+ if (PySlice_Unpack(key, &s[0], &s[1], &s[2]) < 0) {
return NULL;
}
+ s[3] = PySlice_AdjustIndices(len, &s[0], &s[1], s[2]);
ret = PyTuple_New(4);
if (ret == NULL)