17db96d56Sopenharmony_ci/* Tuple object interface */ 27db96d56Sopenharmony_ci 37db96d56Sopenharmony_ci#ifndef Py_TUPLEOBJECT_H 47db96d56Sopenharmony_ci#define Py_TUPLEOBJECT_H 57db96d56Sopenharmony_ci#ifdef __cplusplus 67db96d56Sopenharmony_ciextern "C" { 77db96d56Sopenharmony_ci#endif 87db96d56Sopenharmony_ci 97db96d56Sopenharmony_ci/* 107db96d56Sopenharmony_ciAnother generally useful object type is a tuple of object pointers. 117db96d56Sopenharmony_ciFor Python, this is an immutable type. C code can change the tuple items 127db96d56Sopenharmony_ci(but not their number), and even use tuples as general-purpose arrays of 137db96d56Sopenharmony_ciobject references, but in general only brand new tuples should be mutated, 147db96d56Sopenharmony_cinot ones that might already have been exposed to Python code. 157db96d56Sopenharmony_ci 167db96d56Sopenharmony_ci*** WARNING *** PyTuple_SetItem does not increment the new item's reference 177db96d56Sopenharmony_cicount, but does decrement the reference count of the item it replaces, 187db96d56Sopenharmony_ciif not nil. It does *decrement* the reference count if it is *not* 197db96d56Sopenharmony_ciinserted in the tuple. Similarly, PyTuple_GetItem does not increment the 207db96d56Sopenharmony_cireturned item's reference count. 217db96d56Sopenharmony_ci*/ 227db96d56Sopenharmony_ci 237db96d56Sopenharmony_ciPyAPI_DATA(PyTypeObject) PyTuple_Type; 247db96d56Sopenharmony_ciPyAPI_DATA(PyTypeObject) PyTupleIter_Type; 257db96d56Sopenharmony_ci 267db96d56Sopenharmony_ci#define PyTuple_Check(op) \ 277db96d56Sopenharmony_ci PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) 287db96d56Sopenharmony_ci#define PyTuple_CheckExact(op) Py_IS_TYPE(op, &PyTuple_Type) 297db96d56Sopenharmony_ci 307db96d56Sopenharmony_ciPyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size); 317db96d56Sopenharmony_ciPyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *); 327db96d56Sopenharmony_ciPyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t); 337db96d56Sopenharmony_ciPyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *); 347db96d56Sopenharmony_ciPyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); 357db96d56Sopenharmony_ciPyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); 367db96d56Sopenharmony_ci 377db96d56Sopenharmony_ci#ifndef Py_LIMITED_API 387db96d56Sopenharmony_ci# define Py_CPYTHON_TUPLEOBJECT_H 397db96d56Sopenharmony_ci# include "cpython/tupleobject.h" 407db96d56Sopenharmony_ci# undef Py_CPYTHON_TUPLEOBJECT_H 417db96d56Sopenharmony_ci#endif 427db96d56Sopenharmony_ci 437db96d56Sopenharmony_ci#ifdef __cplusplus 447db96d56Sopenharmony_ci} 457db96d56Sopenharmony_ci#endif 467db96d56Sopenharmony_ci#endif /* !Py_TUPLEOBJECT_H */ 47