diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-04-08 08:18:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-08 08:18:30 (GMT) |
commit | fa25f16a4499178d7d79c18d2d68be7f70594106 (patch) | |
tree | 24842baa21432bc34b05601ed760266361ed267f /Objects/bytearrayobject.c | |
parent | ae0915e42d8cd96e5ced1fc442ea078b4a59e82d (diff) | |
download | cpython-fa25f16a4499178d7d79c18d2d68be7f70594106.zip cpython-fa25f16a4499178d7d79c18d2d68be7f70594106.tar.gz cpython-fa25f16a4499178d7d79c18d2d68be7f70594106.tar.bz2 |
Expand the PySlice_GetIndicesEx macro. (#1023) (#1045)
(cherry picked from commit b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8)
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r-- | Objects/bytearrayobject.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 5132eba..85c6d1b 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -427,11 +427,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); @@ -657,11 +657,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, |