diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-25 13:22:06 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-25 13:22:06 +0200 |
commit | 3efe32ed48330a121cb0e4ebbd429216eb039fa7 (patch) | |
tree | 9e890bc86d78921c0dad1f261a30804880a74062 /Include/sliceobject.h | |
parent | efba28c5800af5b2cec5719d3406881f0544d217 (diff) | |
download | cpython-git-3efe32ed48330a121cb0e4ebbd429216eb039fa7.tar.gz |
Issue #27867: Replaced function PySlice_GetIndicesEx() with a macro.
Diffstat (limited to 'Include/sliceobject.h')
-rw-r--r-- | Include/sliceobject.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Include/sliceobject.h b/Include/sliceobject.h index 8ab62dd4f8..0405edad4d 100644 --- a/Include/sliceobject.h +++ b/Include/sliceobject.h @@ -38,6 +38,16 @@ PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength); +#define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \ + _PySlice_Unpack((PyObject *)(slice), (start), (stop), (step)) < 0 ? -1 : \ + ((*slicelen = _PySlice_AdjustIndices((length), (start), (stop), *(step))), \ + 0)) +PyAPI_FUNC(int) _PySlice_Unpack(PyObject *slice, + Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); +PyAPI_FUNC(Py_ssize_t) _PySlice_AdjustIndices(Py_ssize_t length, + Py_ssize_t *start, Py_ssize_t *stop, + Py_ssize_t step); + #ifdef __cplusplus } #endif |