Expand the PySlice_GetIndicesEx macro. (#1023) (#1044)
(cherry picked from commit b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8)
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
index 4e1ce68..6b8ab34 100644
--- a/Modules/_testbuffer.c
+++ b/Modules/_testbuffer.c
@@ -1715,10 +1715,10 @@
{
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) {
@@ -1935,9 +1935,10 @@
"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)