Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-19 09:50:55

0001 #ifndef Py_SLICEOBJECT_H
0002 #define Py_SLICEOBJECT_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006 
0007 /* The unique ellipsis object "..." */
0008 
0009 PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */
0010 
0011 #if defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030D0000
0012 #  define Py_Ellipsis Py_GetConstantBorrowed(Py_CONSTANT_ELLIPSIS)
0013 #else
0014 #  define Py_Ellipsis (&_Py_EllipsisObject)
0015 #endif
0016 
0017 /* Slice object interface */
0018 
0019 /*
0020 
0021 A slice object containing start, stop, and step data members (the
0022 names are from range).  After much talk with Guido, it was decided to
0023 let these be any arbitrary python type.  Py_None stands for omitted values.
0024 */
0025 #ifndef Py_LIMITED_API
0026 typedef struct {
0027     PyObject_HEAD
0028     PyObject *start, *stop, *step;      /* not NULL */
0029 } PySliceObject;
0030 #endif
0031 
0032 PyAPI_DATA(PyTypeObject) PySlice_Type;
0033 PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
0034 
0035 #define PySlice_Check(op) Py_IS_TYPE((op), &PySlice_Type)
0036 
0037 PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
0038                                   PyObject* step);
0039 #ifndef Py_LIMITED_API
0040 PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
0041 PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
0042                                  PyObject **start_ptr, PyObject **stop_ptr,
0043                                  PyObject **step_ptr);
0044 #endif
0045 PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length,
0046                                   Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
0047 Py_DEPRECATED(3.7)
0048 PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
0049                                      Py_ssize_t *start, Py_ssize_t *stop,
0050                                      Py_ssize_t *step,
0051                                      Py_ssize_t *slicelength);
0052 
0053 #if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100
0054 #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) (  \
0055     PySlice_Unpack((slice), (start), (stop), (step)) < 0 ?                  \
0056     ((*(slicelen) = 0), -1) :                                               \
0057     ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \
0058      0))
0059 PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice,
0060                                Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
0061 PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t length,
0062                                              Py_ssize_t *start, Py_ssize_t *stop,
0063                                              Py_ssize_t step);
0064 #endif
0065 
0066 #ifdef __cplusplus
0067 }
0068 #endif
0069 #endif /* !Py_SLICEOBJECT_H */