annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/python3.8/sliceobject.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 #ifndef Py_SLICEOBJECT_H
jpayne@69 2 #define Py_SLICEOBJECT_H
jpayne@69 3 #ifdef __cplusplus
jpayne@69 4 extern "C" {
jpayne@69 5 #endif
jpayne@69 6
jpayne@69 7 /* The unique ellipsis object "..." */
jpayne@69 8
jpayne@69 9 PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */
jpayne@69 10
jpayne@69 11 #define Py_Ellipsis (&_Py_EllipsisObject)
jpayne@69 12
jpayne@69 13 /* Slice object interface */
jpayne@69 14
jpayne@69 15 /*
jpayne@69 16
jpayne@69 17 A slice object containing start, stop, and step data members (the
jpayne@69 18 names are from range). After much talk with Guido, it was decided to
jpayne@69 19 let these be any arbitrary python type. Py_None stands for omitted values.
jpayne@69 20 */
jpayne@69 21 #ifndef Py_LIMITED_API
jpayne@69 22 typedef struct {
jpayne@69 23 PyObject_HEAD
jpayne@69 24 PyObject *start, *stop, *step; /* not NULL */
jpayne@69 25 } PySliceObject;
jpayne@69 26 #endif
jpayne@69 27
jpayne@69 28 PyAPI_DATA(PyTypeObject) PySlice_Type;
jpayne@69 29 PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
jpayne@69 30
jpayne@69 31 #define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type)
jpayne@69 32
jpayne@69 33 PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
jpayne@69 34 PyObject* step);
jpayne@69 35 #ifndef Py_LIMITED_API
jpayne@69 36 PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
jpayne@69 37 PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
jpayne@69 38 PyObject **start_ptr, PyObject **stop_ptr,
jpayne@69 39 PyObject **step_ptr);
jpayne@69 40 #endif
jpayne@69 41 PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length,
jpayne@69 42 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
jpayne@69 43 Py_DEPRECATED(3.7)
jpayne@69 44 PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
jpayne@69 45 Py_ssize_t *start, Py_ssize_t *stop,
jpayne@69 46 Py_ssize_t *step,
jpayne@69 47 Py_ssize_t *slicelength);
jpayne@69 48
jpayne@69 49 #if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100
jpayne@69 50 #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \
jpayne@69 51 PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? \
jpayne@69 52 ((*(slicelen) = 0), -1) : \
jpayne@69 53 ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \
jpayne@69 54 0))
jpayne@69 55 PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice,
jpayne@69 56 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
jpayne@69 57 PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t length,
jpayne@69 58 Py_ssize_t *start, Py_ssize_t *stop,
jpayne@69 59 Py_ssize_t step);
jpayne@69 60 #endif
jpayne@69 61
jpayne@69 62 #ifdef __cplusplus
jpayne@69 63 }
jpayne@69 64 #endif
jpayne@69 65 #endif /* !Py_SLICEOBJECT_H */