annotate DEPENDENCIES/mingw32/Python27/include/tupleobject.h @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2a2c65a20a8b
children
rev   line source
Chris@87 1
Chris@87 2 /* Tuple object interface */
Chris@87 3
Chris@87 4 #ifndef Py_TUPLEOBJECT_H
Chris@87 5 #define Py_TUPLEOBJECT_H
Chris@87 6 #ifdef __cplusplus
Chris@87 7 extern "C" {
Chris@87 8 #endif
Chris@87 9
Chris@87 10 /*
Chris@87 11 Another generally useful object type is a tuple of object pointers.
Chris@87 12 For Python, this is an immutable type. C code can change the tuple items
Chris@87 13 (but not their number), and even use tuples are general-purpose arrays of
Chris@87 14 object references, but in general only brand new tuples should be mutated,
Chris@87 15 not ones that might already have been exposed to Python code.
Chris@87 16
Chris@87 17 *** WARNING *** PyTuple_SetItem does not increment the new item's reference
Chris@87 18 count, but does decrement the reference count of the item it replaces,
Chris@87 19 if not nil. It does *decrement* the reference count if it is *not*
Chris@87 20 inserted in the tuple. Similarly, PyTuple_GetItem does not increment the
Chris@87 21 returned item's reference count.
Chris@87 22 */
Chris@87 23
Chris@87 24 typedef struct {
Chris@87 25 PyObject_VAR_HEAD
Chris@87 26 PyObject *ob_item[1];
Chris@87 27
Chris@87 28 /* ob_item contains space for 'ob_size' elements.
Chris@87 29 * Items must normally not be NULL, except during construction when
Chris@87 30 * the tuple is not yet visible outside the function that builds it.
Chris@87 31 */
Chris@87 32 } PyTupleObject;
Chris@87 33
Chris@87 34 PyAPI_DATA(PyTypeObject) PyTuple_Type;
Chris@87 35
Chris@87 36 #define PyTuple_Check(op) \
Chris@87 37 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
Chris@87 38 #define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type)
Chris@87 39
Chris@87 40 PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size);
Chris@87 41 PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *);
Chris@87 42 PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t);
Chris@87 43 PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *);
Chris@87 44 PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
Chris@87 45 PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t);
Chris@87 46 PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...);
Chris@87 47 PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
Chris@87 48
Chris@87 49 /* Macro, trading safety for speed */
Chris@87 50 #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i])
Chris@87 51 #define PyTuple_GET_SIZE(op) Py_SIZE(op)
Chris@87 52
Chris@87 53 /* Macro, *only* to be used to fill in brand new tuples */
Chris@87 54 #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
Chris@87 55
Chris@87 56 PyAPI_FUNC(int) PyTuple_ClearFreeList(void);
Chris@87 57
Chris@87 58 #ifdef __cplusplus
Chris@87 59 }
Chris@87 60 #endif
Chris@87 61 #endif /* !Py_TUPLEOBJECT_H */