jpayne@69: /* Tuple object interface */ jpayne@69: jpayne@69: #ifndef Py_TUPLEOBJECT_H jpayne@69: #define Py_TUPLEOBJECT_H jpayne@69: #ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: Another generally useful object type is a tuple of object pointers. jpayne@69: For Python, this is an immutable type. C code can change the tuple items jpayne@69: (but not their number), and even use tuples as general-purpose arrays of jpayne@69: object references, but in general only brand new tuples should be mutated, jpayne@69: not ones that might already have been exposed to Python code. jpayne@69: jpayne@69: *** WARNING *** PyTuple_SetItem does not increment the new item's reference jpayne@69: count, but does decrement the reference count of the item it replaces, jpayne@69: if not nil. It does *decrement* the reference count if it is *not* jpayne@69: inserted in the tuple. Similarly, PyTuple_GetItem does not increment the jpayne@69: returned item's reference count. jpayne@69: */ jpayne@69: jpayne@69: PyAPI_DATA(PyTypeObject) PyTuple_Type; jpayne@69: PyAPI_DATA(PyTypeObject) PyTupleIter_Type; jpayne@69: jpayne@69: #define PyTuple_Check(op) \ jpayne@69: PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) jpayne@69: #define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type) jpayne@69: jpayne@69: PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size); jpayne@69: PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *); jpayne@69: PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t); jpayne@69: PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *); jpayne@69: PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); jpayne@69: PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); jpayne@69: jpayne@69: PyAPI_FUNC(int) PyTuple_ClearFreeList(void); jpayne@69: jpayne@69: #ifndef Py_LIMITED_API jpayne@69: # define Py_CPYTHON_TUPLEOBJECT_H jpayne@69: # include "cpython/tupleobject.h" jpayne@69: # undef Py_CPYTHON_TUPLEOBJECT_H jpayne@69: #endif jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: } jpayne@69: #endif jpayne@69: #endif /* !Py_TUPLEOBJECT_H */