Coverage Report

Created: 2022-07-08 09:39

/home/mdboom/Work/builds/cpython/Include/listobject.h
Line
Count
Source
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
17
extern "C" {
18
#endif
19
20
PyAPI_DATA(PyTypeObject) PyList_Type;
21
PyAPI_DATA(PyTypeObject) PyListIter_Type;
22
PyAPI_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
28
PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
29
PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
30
31
PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t);
32
PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
33
PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
34
PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
35
36
PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
37
PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
38
39
PyAPI_FUNC(int) PyList_Sort(PyObject *);
40
PyAPI_FUNC(int) PyList_Reverse(PyObject *);
41
PyAPI_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 */