Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:49

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 PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
0033 PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
0034 PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
0035 
0036 PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
0037 PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
0038 
0039 PyAPI_FUNC(int) PyList_Sort(PyObject *);
0040 PyAPI_FUNC(int) PyList_Reverse(PyObject *);
0041 PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
0042 
0043 #ifndef Py_LIMITED_API
0044 #  define Py_CPYTHON_LISTOBJECT_H
0045 #  include "cpython/listobject.h"
0046 #  undef Py_CPYTHON_LISTOBJECT_H
0047 #endif
0048 
0049 #ifdef __cplusplus
0050 }
0051 #endif
0052 #endif /* !Py_LISTOBJECT_H */