2020-02-07 09:20:22 +01:00
|
|
|
/* List object interface
|
1991-02-19 13:39:46 +01:00
|
|
|
|
2020-02-07 09:20:22 +01:00
|
|
|
Another generally useful object type is a list of object pointers.
|
|
|
|
This is a mutable type: the list items can be changed, and items can be
|
|
|
|
added or removed. Out-of-range indices or non-list objects are ignored.
|
1990-10-14 13:07:46 +01:00
|
|
|
|
2020-02-07 09:20:22 +01:00
|
|
|
WARNING: PyList_SetItem does not increment the new item's reference count,
|
|
|
|
but does decrement the reference count of the item it replaces, if not nil.
|
|
|
|
It does *decrement* the reference count if it is *not* inserted in the list.
|
|
|
|
Similarly, PyList_GetItem does not increment the returned item's reference
|
|
|
|
count.
|
1990-10-14 13:07:46 +01:00
|
|
|
*/
|
|
|
|
|
2000-07-09 02:20:36 +02:00
|
|
|
#ifndef Py_LISTOBJECT_H
|
|
|
|
#define Py_LISTOBJECT_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2002-08-12 09:21:58 +02:00
|
|
|
PyAPI_DATA(PyTypeObject) PyList_Type;
|
2007-11-29 23:35:39 +01:00
|
|
|
PyAPI_DATA(PyTypeObject) PyListIter_Type;
|
|
|
|
PyAPI_DATA(PyTypeObject) PyListRevIter_Type;
|
1990-10-14 13:07:46 +01:00
|
|
|
|
2007-02-25 21:39:11 +01:00
|
|
|
#define PyList_Check(op) \
|
2014-05-27 00:12:28 +02:00
|
|
|
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
|
2022-06-16 13:49:43 +02:00
|
|
|
#define PyList_CheckExact(op) Py_IS_TYPE((op), &PyList_Type)
|
1990-10-14 13:07:46 +01:00
|
|
|
|
2006-02-15 18:27:45 +01:00
|
|
|
PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
|
|
|
|
PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
|
2020-02-07 09:20:22 +01:00
|
|
|
|
2006-02-15 18:27:45 +01:00
|
|
|
PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t);
|
2024-02-02 14:03:15 +01:00
|
|
|
PyAPI_FUNC(PyObject *) PyList_GetItemRef(PyObject *, Py_ssize_t);
|
2006-02-15 18:27:45 +01:00
|
|
|
PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
|
|
|
|
PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
|
2002-08-12 09:21:58 +02:00
|
|
|
PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
|
2020-02-07 09:20:22 +01:00
|
|
|
|
2006-02-15 18:27:45 +01:00
|
|
|
PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
|
|
|
|
PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
|
2020-02-07 09:20:22 +01:00
|
|
|
|
2002-08-12 09:21:58 +02:00
|
|
|
PyAPI_FUNC(int) PyList_Sort(PyObject *);
|
|
|
|
PyAPI_FUNC(int) PyList_Reverse(PyObject *);
|
|
|
|
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
|
1990-12-20 16:06:42 +01:00
|
|
|
|
2010-12-03 21:14:31 +01:00
|
|
|
#ifndef Py_LIMITED_API
|
2020-02-07 09:20:22 +01:00
|
|
|
# define Py_CPYTHON_LISTOBJECT_H
|
2021-10-15 01:50:04 +02:00
|
|
|
# include "cpython/listobject.h"
|
2020-02-07 09:20:22 +01:00
|
|
|
# undef Py_CPYTHON_LISTOBJECT_H
|
2010-12-03 21:14:31 +01:00
|
|
|
#endif
|
1993-07-28 11:05:47 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_LISTOBJECT_H */
|