summaryrefslogtreecommitdiffstats
path: root/Modules/mmapmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-04-08 06:53:51 (GMT)
committerGitHub <noreply@github.com>2017-04-08 06:53:51 (GMT)
commitb879fe82e7e5c3f7673c9a7fa4aad42bd05445d8 (patch)
tree714c168e58166c2acb07b737ce3ca02db71fe2af /Modules/mmapmodule.c
parent205e00c5cfd495a4dc6dae8e8fa0fb828fb3dca9 (diff)
downloadcpython-b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8.zip
cpython-b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8.tar.gz
cpython-b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8.tar.bz2
Expand the PySlice_GetIndicesEx macro. (#1023)
Diffstat (limited to 'Modules/mmapmodule.c')
-rw-r--r--Modules/mmapmodule.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 56f4400..49214a1 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -778,10 +778,10 @@ mmap_subscript(mmap_object *self, PyObject *item)
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelen;
- if (PySlice_GetIndicesEx(item, self->size,
- &start, &stop, &step, &slicelen) < 0) {
+ if (PySlice_Unpack(item, &start, &stop, &step) < 0) {
return NULL;
}
+ slicelen = PySlice_AdjustIndices(self->size, &start, &stop, step);
if (slicelen <= 0)
return PyBytes_FromStringAndSize("", 0);
@@ -904,11 +904,10 @@ mmap_ass_subscript(mmap_object *self, PyObject *item, PyObject *value)
Py_ssize_t start, stop, step, slicelen;
Py_buffer vbuf;
- if (PySlice_GetIndicesEx(item,
- self->size, &start, &stop,
- &step, &slicelen) < 0) {
+ if (PySlice_Unpack(item, &start, &stop, &step) < 0) {
return -1;
}
+ slicelen = PySlice_AdjustIndices(self->size, &start, &stop, step);
if (value == NULL) {
PyErr_SetString(PyExc_TypeError,
"mmap object doesn't support slice deletion");