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