annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/python3.8/tupleobject.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 /* Tuple object interface */
jpayne@69 2
jpayne@69 3 #ifndef Py_TUPLEOBJECT_H
jpayne@69 4 #define Py_TUPLEOBJECT_H
jpayne@69 5 #ifdef __cplusplus
jpayne@69 6 extern "C" {
jpayne@69 7 #endif
jpayne@69 8
jpayne@69 9 /*
jpayne@69 10 Another generally useful object type is a tuple of object pointers.
jpayne@69 11 For Python, this is an immutable type. C code can change the tuple items
jpayne@69 12 (but not their number), and even use tuples as general-purpose arrays of
jpayne@69 13 object references, but in general only brand new tuples should be mutated,
jpayne@69 14 not ones that might already have been exposed to Python code.
jpayne@69 15
jpayne@69 16 *** WARNING *** PyTuple_SetItem does not increment the new item's reference
jpayne@69 17 count, but does decrement the reference count of the item it replaces,
jpayne@69 18 if not nil. It does *decrement* the reference count if it is *not*
jpayne@69 19 inserted in the tuple. Similarly, PyTuple_GetItem does not increment the
jpayne@69 20 returned item's reference count.
jpayne@69 21 */
jpayne@69 22
jpayne@69 23 PyAPI_DATA(PyTypeObject) PyTuple_Type;
jpayne@69 24 PyAPI_DATA(PyTypeObject) PyTupleIter_Type;
jpayne@69 25
jpayne@69 26 #define PyTuple_Check(op) \
jpayne@69 27 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
jpayne@69 28 #define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type)
jpayne@69 29
jpayne@69 30 PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size);
jpayne@69 31 PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *);
jpayne@69 32 PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t);
jpayne@69 33 PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *);
jpayne@69 34 PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
jpayne@69 35 PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...);
jpayne@69 36
jpayne@69 37 PyAPI_FUNC(int) PyTuple_ClearFreeList(void);
jpayne@69 38
jpayne@69 39 #ifndef Py_LIMITED_API
jpayne@69 40 # define Py_CPYTHON_TUPLEOBJECT_H
jpayne@69 41 # include "cpython/tupleobject.h"
jpayne@69 42 # undef Py_CPYTHON_TUPLEOBJECT_H
jpayne@69 43 #endif
jpayne@69 44
jpayne@69 45 #ifdef __cplusplus
jpayne@69 46 }
jpayne@69 47 #endif
jpayne@69 48 #endif /* !Py_TUPLEOBJECT_H */