tupleobject.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef Py_CPYTHON_TUPLEOBJECT_H
  2. # error "this header file must not be included directly"
  3. #endif
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef struct {
  8. PyObject_VAR_HEAD
  9. /* ob_item contains space for 'ob_size' elements.
  10. Items must normally not be NULL, except during construction when
  11. the tuple is not yet visible outside the function that builds it. */
  12. PyObject *ob_item[1];
  13. } PyTupleObject;
  14. PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t);
  15. PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
  16. /* Macros trading safety for speed */
  17. /* Cast argument to PyTupleObject* type. */
  18. #define _PyTuple_CAST(op) (assert(PyTuple_Check(op)), (PyTupleObject *)(op))
  19. #define PyTuple_GET_SIZE(op) Py_SIZE(_PyTuple_CAST(op))
  20. #define PyTuple_GET_ITEM(op, i) (_PyTuple_CAST(op)->ob_item[i])
  21. /* Macro, *only* to be used to fill in brand new tuples */
  22. #define PyTuple_SET_ITEM(op, i, v) (_PyTuple_CAST(op)->ob_item[i] = v)
  23. PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out);
  24. #ifdef __cplusplus
  25. }
  26. #endif