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