1/* List object interface
2
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 be
5 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 reference
11 count.
12*/
13
14#ifndef Py_LISTOBJECT_H
15#define Py_LISTOBJECT_H
16#ifdef __cplusplus
17extern "C" {
18#endif
19
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);
32PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
33PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
34PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
35
36PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
37PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
38
39PyAPI_FUNC(int) PyList_Sort(PyObject *);
40PyAPI_FUNC(int) PyList_Reverse(PyObject *);
41PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
42
43#ifndef Py_LIMITED_API
44# define Py_CPYTHON_LISTOBJECT_H
45# include "cpython/listobject.h"
46# undef Py_CPYTHON_LISTOBJECT_H
47#endif
48
49#ifdef __cplusplus
50}
51#endif
52#endif /* !Py_LISTOBJECT_H */
53

source code of include/python3.10/listobject.h