summaryrefslogtreecommitdiff
path: root/Objects/listobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-04-08 09:53:51 +0300
committerGitHub <noreply@github.com>2017-04-08 09:53:51 +0300
commitb879fe82e7e5c3f7673c9a7fa4aad42bd05445d8 (patch)
tree714c168e58166c2acb07b737ce3ca02db71fe2af /Objects/listobject.c
parent205e00c5cfd495a4dc6dae8e8fa0fb828fb3dca9 (diff)
downloadcpython-git-b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8.tar.gz
Expand the PySlice_GetIndicesEx macro. (#1023)
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r--Objects/listobject.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 9b42106e30..314a13c4c8 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2486,10 +2486,11 @@ list_subscript(PyListObject* self, PyObject* item)
PyObject* it;
PyObject **src, **dest;
- 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 PyList_New(0);
@@ -2535,10 +2536,11 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value)
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- 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);
if (step == 1)
return list_ass_slice(self, start, stop, value);