diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-25 11:27:44 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-25 11:27:44 (GMT) |
commit | 6e08baf12da60950561d50273799df93d120c127 (patch) | |
tree | 47c83df77e52659776a270fe29509c21b9174af5 /Include/sliceobject.h | |
parent | a8df8471d254086548325ffc451cdb73111bce83 (diff) | |
parent | 512c57cb72e108d0f68ceecbc88dfe3b2eb56371 (diff) | |
download | cpython-6e08baf12da60950561d50273799df93d120c127.zip cpython-6e08baf12da60950561d50273799df93d120c127.tar.gz cpython-6e08baf12da60950561d50273799df93d120c127.tar.bz2 |
Issue #27867: Function PySlice_GetIndicesEx() is deprecated and replaced with
a macro if Py_LIMITED_API is not set or set to the value between 0x03050400
and 0x03060000 (not including) or 0x03060100 or higher. Added functions
PySlice_Unpack() and PySlice_AdjustIndices().
Diffstat (limited to 'Include/sliceobject.h')
-rw-r--r-- | Include/sliceobject.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Include/sliceobject.h b/Include/sliceobject.h index 26370e0..edd14c5 100644 --- a/Include/sliceobject.h +++ b/Include/sliceobject.h @@ -41,8 +41,20 @@ PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length, PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length, - Py_ssize_t *start, Py_ssize_t *stop, - Py_ssize_t *step, Py_ssize_t *slicelength); + Py_ssize_t *start, Py_ssize_t *stop, + Py_ssize_t *step, Py_ssize_t *slicelength) Py_DEPRECATED(3.7); + +#if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100 +#define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \ + PySlice_Unpack((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); +#endif #ifdef __cplusplus } |