Skip to content

Commit e15d0de

Browse files
committed
Slice and ellipses interface
1 parent fdebf25 commit e15d0de

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Include/sliceobject.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#ifndef Py_SLICEOBJECT_H
2+
#define Py_SLICEOBJECT_H
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
/* The unique ellipses object "..." */
8+
9+
extern DL_IMPORT(PyObject) _Py_EllipsesObject; /* Don't use this directly */
10+
11+
#define Py_Ellipses (&_Py_EllipsesObject)
12+
13+
14+
/* Slice object interface */
15+
16+
/*
17+
18+
A slice object containing start, stop, and step data members (the
19+
names are from range). After much talk with Guido, it was decided to
20+
let these be any arbitrary python type.
21+
*/
22+
23+
typedef struct {
24+
PyObject_HEAD
25+
PyObject *start, *stop, *step;
26+
} PySliceObject;
27+
28+
extern DL_IMPORT(PyTypeObject) PySlice_Type;
29+
30+
#define PySlice_Check(op) ((op)->ob_type == &PySlice_Type)
31+
32+
PyObject *PySlice_New Py_PROTO((
33+
PyObject* start, PyObject* stop, PyObject* step));
34+
int PySlice_GetIndices Py_PROTO((
35+
PySliceObject *r, int length, int *start, int *stop, int *step));
36+
37+
#ifdef __cplusplus
38+
}
39+
#endif
40+
#endif /* !Py_SLICEOBJECT_H */

0 commit comments

Comments
 (0)