File indexing completed on 2025-01-30 10:18:03
0001 #ifndef Py_CPYTHON_LISTOBJECT_H
0002 # error "this header file must not be included directly"
0003 #endif
0004
0005 typedef struct {
0006 PyObject_VAR_HEAD
0007
0008 PyObject **ob_item;
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 Py_ssize_t allocated;
0022 } PyListObject;
0023
0024 PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
0025 PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
0026
0027
0028 #define _PyList_CAST(op) \
0029 (assert(PyList_Check(op)), _Py_CAST(PyListObject*, (op)))
0030
0031
0032
0033 static inline Py_ssize_t PyList_GET_SIZE(PyObject *op) {
0034 PyListObject *list = _PyList_CAST(op);
0035 return Py_SIZE(list);
0036 }
0037 #define PyList_GET_SIZE(op) PyList_GET_SIZE(_PyObject_CAST(op))
0038
0039 #define PyList_GET_ITEM(op, index) (_PyList_CAST(op)->ob_item[(index)])
0040
0041 static inline void
0042 PyList_SET_ITEM(PyObject *op, Py_ssize_t index, PyObject *value) {
0043 PyListObject *list = _PyList_CAST(op);
0044 list->ob_item[index] = value;
0045 }
0046 #define PyList_SET_ITEM(op, index, value) \
0047 PyList_SET_ITEM(_PyObject_CAST(op), (index), _PyObject_CAST(value))