Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:51

0001 /* Tuple object interface */
0002 
0003 #ifndef Py_TUPLEOBJECT_H
0004 #define Py_TUPLEOBJECT_H
0005 #ifdef __cplusplus
0006 extern "C" {
0007 #endif
0008 
0009 /*
0010 Another generally useful object type is a tuple of object pointers.
0011 For Python, this is an immutable type.  C code can change the tuple items
0012 (but not their number), and even use tuples as general-purpose arrays of
0013 object references, but in general only brand new tuples should be mutated,
0014 not ones that might already have been exposed to Python code.
0015 
0016 *** WARNING *** PyTuple_SetItem does not increment the new item's reference
0017 count, but does decrement the reference count of the item it replaces,
0018 if not nil.  It does *decrement* the reference count if it is *not*
0019 inserted in the tuple.  Similarly, PyTuple_GetItem does not increment the
0020 returned item's reference count.
0021 */
0022 
0023 PyAPI_DATA(PyTypeObject) PyTuple_Type;
0024 PyAPI_DATA(PyTypeObject) PyTupleIter_Type;
0025 
0026 #define PyTuple_Check(op) \
0027                  PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
0028 #define PyTuple_CheckExact(op) Py_IS_TYPE((op), &PyTuple_Type)
0029 
0030 PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size);
0031 PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *);
0032 PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t);
0033 PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *);
0034 PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
0035 PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...);
0036 
0037 #ifndef Py_LIMITED_API
0038 #  define Py_CPYTHON_TUPLEOBJECT_H
0039 #  include "cpython/tupleobject.h"
0040 #  undef Py_CPYTHON_TUPLEOBJECT_H
0041 #endif
0042 
0043 #ifdef __cplusplus
0044 }
0045 #endif
0046 #endif /* !Py_TUPLEOBJECT_H */