summaryrefslogtreecommitdiffstats
path: root/Objects/bytearrayobject.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 /Objects/bytearrayobject.c
parent205e00c5cfd495a4dc6dae8e8fa0fb828fb3dca9 (diff)
downloadcpython-b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8.zip
cpython-b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8.tar.gz
cpython-b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8.tar.bz2
Expand the PySlice_GetIndicesEx macro. (#1023)
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r--Objects/bytearrayobject.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index fe322d2..22dd810 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -400,11 +400,11 @@ bytearray_subscript(PyByteArrayObject *self, PyObject *index)
}
else if (PySlice_Check(index)) {
Py_ssize_t start, stop, step, slicelength, cur, i;
- if (PySlice_GetIndicesEx(index,
- PyByteArray_GET_SIZE(self),
- &start, &stop, &step, &slicelength) < 0) {
+ if (PySlice_Unpack(index, &start, &stop, &step) < 0) {
return NULL;
}
+ slicelength = PySlice_AdjustIndices(PyByteArray_GET_SIZE(self),
+ &start, &stop, step);
if (slicelength <= 0)
return PyByteArray_FromStringAndSize("", 0);
@@ -630,11 +630,11 @@ bytearray_ass_subscript(PyByteArrayObject *self, PyObject *index, PyObject *valu
}
}
else if (PySlice_Check(index)) {
- if (PySlice_GetIndicesEx(index,
- PyByteArray_GET_SIZE(self),
- &start, &stop, &step, &slicelen) < 0) {
+ if (PySlice_Unpack(index, &start, &stop, &step) < 0) {
return -1;
}
+ slicelen = PySlice_AdjustIndices(PyByteArray_GET_SIZE(self), &start,
+ &stop, step);
}
else {
PyErr_Format(PyExc_TypeError,