summaryrefslogtreecommitdiffstats
path: root/Modules/arraymodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r--Modules/arraymodule.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 8612847..f615a69 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -2343,10 +2343,11 @@ array_subscr(arrayobject* self, PyObject* item)
arrayobject* ar;
int itemsize = self->ob_descr->itemsize;
- if (PySlice_GetIndicesEx(item, Py_SIZE(self),
- &start, &stop, &step, &slicelength) < 0) {
+ if (PySlice_Unpack(item, &start, &stop, &step) < 0) {
return NULL;
}
+ slicelength = PySlice_AdjustIndices(Py_SIZE(self), &start, &stop,
+ step);
if (slicelength <= 0) {
return newarrayobject(&Arraytype, 0, self->ob_descr);
@@ -2414,11 +2415,11 @@ array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
return (*self->ob_descr->setitem)(self, i, value);
}
else if (PySlice_Check(item)) {
- if (PySlice_GetIndicesEx(item,
- Py_SIZE(self), &start, &stop,
- &step, &slicelength) < 0) {
+ if (PySlice_Unpack(item, &start, &stop, &step) < 0) {
return -1;
}
+ slicelength = PySlice_AdjustIndices(Py_SIZE(self), &start, &stop,
+ step);
}
else {
PyErr_SetString(PyExc_TypeError,