Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:18:04

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     /* ob_item contains space for 'ob_size' elements.
0008        Items must normally not be NULL, except during construction when
0009        the tuple is not yet visible outside the function that builds it. */
0010     PyObject *ob_item[1];
0011 } PyTupleObject;
0012 
0013 PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t);
0014 PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
0015 
0016 /* Cast argument to PyTupleObject* type. */
0017 #define _PyTuple_CAST(op) \
0018     (assert(PyTuple_Check(op)), _Py_CAST(PyTupleObject*, (op)))
0019 
0020 // Macros and static inline functions, trading safety for speed
0021 
0022 static inline Py_ssize_t PyTuple_GET_SIZE(PyObject *op) {
0023     PyTupleObject *tuple = _PyTuple_CAST(op);
0024     return Py_SIZE(tuple);
0025 }
0026 #define PyTuple_GET_SIZE(op) PyTuple_GET_SIZE(_PyObject_CAST(op))
0027 
0028 #define PyTuple_GET_ITEM(op, index) (_PyTuple_CAST(op)->ob_item[(index)])
0029 
0030 /* Function *only* to be used to fill in brand new tuples */
0031 static inline void
0032 PyTuple_SET_ITEM(PyObject *op, Py_ssize_t index, PyObject *value) {
0033     PyTupleObject *tuple = _PyTuple_CAST(op);
0034     tuple->ob_item[index] = value;
0035 }
0036 #define PyTuple_SET_ITEM(op, index, value) \
0037     PyTuple_SET_ITEM(_PyObject_CAST(op), (index), _PyObject_CAST(value))
0038 
0039 PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out);