diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2017-04-08 06:53:51 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-08 06:53:51 (GMT) |
| commit | b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8 (patch) | |
| tree | 714c168e58166c2acb07b737ce3ca02db71fe2af /Modules/arraymodule.c | |
| parent | 205e00c5cfd495a4dc6dae8e8fa0fb828fb3dca9 (diff) | |
| download | cpython-b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8.zip cpython-b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8.tar.gz cpython-b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8.tar.bz2 | |
Expand the PySlice_GetIndicesEx macro. (#1023)
Diffstat (limited to 'Modules/arraymodule.c')
| -rw-r--r-- | Modules/arraymodule.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index e067b30..412e39e 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -2289,10 +2289,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); @@ -2360,11 +2361,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, |
