File indexing completed on 2025-11-19 09:50:43
0001 #ifndef Py_CPYTHON_TUPLEOBJECT_H
0002 # error "this header file must not be included directly"
0003 #endif
0004
0005 typedef struct {
0006 PyObject_VAR_HEAD
0007
0008
0009
0010 PyObject *ob_item[1];
0011 } PyTupleObject;
0012
0013 PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t);
0014
0015
0016 #define _PyTuple_CAST(op) \
0017 (assert(PyTuple_Check(op)), _Py_CAST(PyTupleObject*, (op)))
0018
0019
0020
0021 static inline Py_ssize_t PyTuple_GET_SIZE(PyObject *op) {
0022 PyTupleObject *tuple = _PyTuple_CAST(op);
0023 return Py_SIZE(tuple);
0024 }
0025 #define PyTuple_GET_SIZE(op) PyTuple_GET_SIZE(_PyObject_CAST(op))
0026
0027 #define PyTuple_GET_ITEM(op, index) (_PyTuple_CAST(op)->ob_item[(index)])
0028
0029
0030 static inline void
0031 PyTuple_SET_ITEM(PyObject *op, Py_ssize_t index, PyObject *value) {
0032 PyTupleObject *tuple = _PyTuple_CAST(op);
0033 assert(0 <= index);
0034 assert(index < Py_SIZE(tuple));
0035 tuple->ob_item[index] = value;
0036 }
0037 #define PyTuple_SET_ITEM(op, index, value) \
0038 PyTuple_SET_ITEM(_PyObject_CAST(op), (index), _PyObject_CAST(value))