bpo-27867: Expand the PySlice_GetIndicesEx macro. (#1023) (#1046)
(cherry picked from commit b879fe8)
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 9b93898..ef4f8c1 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -1310,11 +1310,11 @@
char* result_buf;
PyObject* result;
- if (PySlice_GetIndicesEx((PySliceObject*)item,
- PyString_GET_SIZE(self),
- &start, &stop, &step, &slicelength) < 0) {
+ if (_PySlice_Unpack((PySliceObject *)item, &start, &stop, &step) < 0) {
return NULL;
}
+ slicelength = _PySlice_AdjustIndices(PyString_GET_SIZE(self), &start,
+ &stop, step);
if (slicelength <= 0) {
return PyString_FromStringAndSize("", 0);