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/_testbuffer.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/_testbuffer.c')
| -rw-r--r-- | Modules/_testbuffer.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c index 4e1ce68..6b8ab34 100644 --- a/Modules/_testbuffer.c +++ b/Modules/_testbuffer.c @@ -1715,10 +1715,10 @@ init_slice(Py_buffer *base, PyObject *key, int dim) { Py_ssize_t start, stop, step, slicelength; - if (PySlice_GetIndicesEx(key, base->shape[dim], - &start, &stop, &step, &slicelength) < 0) { + if (PySlice_Unpack(key, &start, &stop, &step) < 0) { return -1; } + slicelength = PySlice_AdjustIndices(base->shape[dim], &start, &stop, step); if (base->suboffsets == NULL || dim == 0) { @@ -1935,9 +1935,10 @@ slice_indices(PyObject *self, PyObject *args) "first argument must be a slice object"); return NULL; } - if (PySlice_GetIndicesEx(key, len, &s[0], &s[1], &s[2], &s[3]) < 0) { + if (PySlice_Unpack(key, &s[0], &s[1], &s[2]) < 0) { return NULL; } + s[3] = PySlice_AdjustIndices(len, &s[0], &s[1], s[2]); ret = PyTuple_New(4); if (ret == NULL) |
