Skip to content

Commit 3f20852

Browse files
committed
only define our accessor functions for slice objects' struct fields when the struct itself is defined
1 parent 8798a41 commit 3f20852

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

graalpython/com.oracle.graal.python.cext/include/sliceobject.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ typedef struct {
2929
PyObject_HEAD
3030
PyObject *start, *stop, *step; /* not NULL */
3131
} PySliceObject;
32+
33+
// functions introduced by GraalPy as replacements for direct access to the slice struct fields
34+
PyAPI_FUNC(PyObject*) PySlice_Start(PySliceObject *slice);
35+
PyAPI_FUNC(PyObject*) PySlice_Stop(PySliceObject *slice);
36+
PyAPI_FUNC(PyObject*) PySlice_Step(PySliceObject *slice);
3237
#endif
3338

3439
PyAPI_DATA(PyTypeObject) PySlice_Type;
@@ -58,9 +63,6 @@ PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
5863
((*(slicelen) = 0), -1) : \
5964
((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \
6065
0))
61-
PyAPI_FUNC(PyObject*) PySlice_Start(PySliceObject *slice);
62-
PyAPI_FUNC(PyObject*) PySlice_Stop(PySliceObject *slice);
63-
PyAPI_FUNC(PyObject*) PySlice_Step(PySliceObject *slice);
6466
PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice,
6567
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
6668
PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t length,

0 commit comments

Comments
 (0)