summaryrefslogtreecommitdiff
path: root/Include/sliceobject.h
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-01-25 13:22:06 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2017-01-25 13:22:06 +0200
commit3efe32ed48330a121cb0e4ebbd429216eb039fa7 (patch)
tree9e890bc86d78921c0dad1f261a30804880a74062 /Include/sliceobject.h
parentefba28c5800af5b2cec5719d3406881f0544d217 (diff)
downloadcpython-git-3efe32ed48330a121cb0e4ebbd429216eb039fa7.tar.gz
Issue #27867: Replaced function PySlice_GetIndicesEx() with a macro.
Diffstat (limited to 'Include/sliceobject.h')
-rw-r--r--Include/sliceobject.h10
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