codekingpro/portable-devtools
114k
1/* List object interface2 3 Another generally useful object type is a list of object pointers.4 This is a mutable type: the list items can be changed, and items can be5 added or removed. Out-of-range indices or non-list objects are ignored.6 7 WARNING: PyList_SetItem does not increment the new item's reference count,8 but does decrement the reference count of the item it replaces, if not nil.9 It does *decrement* the reference count if it is *not* inserted in the list.10 Similarly, PyList_GetItem does not increment the returned item's reference11 count.12*/13 14#ifndef Py_LISTOBJECT_H15#define Py_LISTOBJECT_H16#ifdef __cplusplus17extern "C" {18#endif19 20PyAPI_DATA(PyTypeObject) PyList_Type;21PyAPI_DATA(PyTypeObject) PyListIter_Type;22PyAPI_DATA(PyTypeObject) PyListRevIter_Type;23 24#define PyList_Check(op) \25 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)26#define PyList_CheckExact(op) Py_IS_TYPE((op), &PyList_Type)27 28PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);29PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);30 31PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t);32#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d000033PyAPI_FUNC(PyObject *) PyList_GetItemRef(PyObject *, Py_ssize_t);34#endif35PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);36PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);37PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);38 39PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);40PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);41 42PyAPI_FUNC(int) PyList_Sort(PyObject *);43PyAPI_FUNC(int) PyList_Reverse(PyObject *);44PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);45 46#ifndef Py_LIMITED_API47# define Py_CPYTHON_LISTOBJECT_H48# include "cpython/listobject.h"49# undef Py_CPYTHON_LISTOBJECT_H50#endif51 52#ifdef __cplusplus53}54#endif55#endif /* !Py_LISTOBJECT_H */56 