2020-02-07 08:20:22 +00:00
|
|
|
/* List object interface
|
1991-02-19 12:39:46 +00:00
|
|
|
|
2020-02-07 08:20:22 +00: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 12:07:46 +00:00
|
|
|
|
2020-02-07 08:20:22 +00: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 12:07:46 +00:00
|
|
|
*/
|
|
|
|
|
2000-07-09 00:20:36 +00:00
|
|
|
#ifndef Py_LISTOBJECT_H
|
|
|
|
#define Py_LISTOBJECT_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2002-08-12 07:21:58 +00:00
|
|
|
PyAPI_DATA(PyTypeObject) PyList_Type;
|
2007-11-29 22:35:39 +00:00
|
|
|
PyAPI_DATA(PyTypeObject) PyListIter_Type;
|
|
|
|
PyAPI_DATA(PyTypeObject) PyListRevIter_Type;
|
1990-10-14 12:07:46 +00:00
|
|
|
|
2007-02-25 20:39:11 +00:00
|
|
|
#define PyList_Check(op) \
|
2014-05-26 22:12:28 +00:00
|
|
|
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
|
2022-06-16 11:49:43 +00:00
|
|
|
#define PyList_CheckExact(op) Py_IS_TYPE((op), &PyList_Type)
|
1990-10-14 12:07:46 +00:00
|
|
|
|
2006-02-15 17:27:45 +00:00
|
|
|
PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
|
|
|
|
PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
|
2020-02-07 08:20:22 +00:00
|
|
|
|
2006-02-15 17:27:45 +00:00
|
|
|
PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t);
|
2024-04-03 21:02:42 +00:00
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
|
2024-02-02 13:03:15 +00:00
|
|
|
PyAPI_FUNC(PyObject *) PyList_GetItemRef(PyObject *, Py_ssize_t);
|
2024-04-03 21:02:42 +00:00
|
|
|
#endif
|
2006-02-15 17:27:45 +00:00
|
|
|
PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
|
|
|
|
PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
|
2002-08-12 07:21:58 +00:00
|
|
|
PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
|
2020-02-07 08:20:22 +00:00
|
|
|
|
2006-02-15 17:27:45 +00: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 08:20:22 +00:00
|
|
|
|
2002-08-12 07:21:58 +00:00
|
|
|
PyAPI_FUNC(int) PyList_Sort(PyObject *);
|
|
|
|
PyAPI_FUNC(int) PyList_Reverse(PyObject *);
|
|
|
|
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
|
1990-12-20 15:06:42 +00:00
|
|
|
|
2010-12-03 20:14:31 +00:00
|
|
|
#ifndef Py_LIMITED_API
|
2020-02-07 08:20:22 +00:00
|
|
|
# define Py_CPYTHON_LISTOBJECT_H
|
2021-10-14 23:50:04 +00:00
|
|
|
# include "cpython/listobject.h"
|
2020-02-07 08:20:22 +00:00
|
|
|
# undef Py_CPYTHON_LISTOBJECT_H
|
2010-12-03 20:14:31 +00:00
|
|
|
#endif
|
1993-07-28 09:05:47 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_LISTOBJECT_H */
|