bpo-27867: Expand the PySlice_GetIndicesEx macro. (#1023) (#1046)
(cherry picked from commit b879fe8)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 7986d70..689529a 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8008,10 +8008,11 @@
Py_UNICODE* result_buf;
PyObject* result;
- if (PySlice_GetIndicesEx((PySliceObject*)item, PyUnicode_GET_SIZE(self),
- &start, &stop, &step, &slicelength) < 0) {
+ if (_PySlice_Unpack((PySliceObject *)item, &start, &stop, &step) < 0) {
return NULL;
}
+ slicelength = _PySlice_AdjustIndices(PyUnicode_GET_SIZE(self), &start,
+ &stop, step);
if (slicelength <= 0) {
return PyUnicode_FromUnicode(NULL, 0);