Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /* List object interface
0002 
0003    Another generally useful object type is a list of object pointers.
0004    This is a mutable type: the list items can be changed, and items can be
0005    added or removed. Out-of-range indices or non-list objects are ignored.
0006 
0007    WARNING: PyList_SetItem does not increment the new item's reference count,
0008    but does decrement the reference count of the item it replaces, if not nil.
0009    It does *decrement* the reference count if it is *not* inserted in the list.
0010    Similarly, PyList_GetItem does not increment the returned item's reference
0011    count.
0012 */
0013 
0014 #ifndef Py_LISTOBJECT_H
0015 #define Py_LISTOBJECT_H
0016 #ifdef __cplusplus
0017 extern "C" {
0018 #endif
0019 
0020 PyAPI_DATA(PyTypeObject) PyList_Type;
0021 PyAPI_DATA(PyTypeObject) PyListIter_Type;
0022 PyAPI_DATA(PyTypeObject) PyListRevIter_Type;
0023 
0024 #define PyList_Check(op) \
0025     PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
0026 #define PyList_CheckExact(op) Py_IS_TYPE((op), &PyList_Type)
0027 
0028 PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
0029 PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
0030 
0031 PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t);
0032 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
0033 PyAPI_FUNC(PyObject *) PyList_GetItemRef(PyObject *, Py_ssize_t);
0034 #endif
0035 PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
0036 PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
0037 PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
0038 
0039 PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
0040 PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
0041 
0042 PyAPI_FUNC(int) PyList_Sort(PyObject *);
0043 PyAPI_FUNC(int) PyList_Reverse(PyObject *);
0044 PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
0045 
0046 #ifndef Py_LIMITED_API
0047 #  define Py_CPYTHON_LISTOBJECT_H
0048 #  include "cpython/listobject.h"
0049 #  undef Py_CPYTHON_LISTOBJECT_H
0050 #endif
0051 
0052 #ifdef __cplusplus
0053 }
0054 #endif
0055 #endif /* !Py_LISTOBJECT_H */