tupleobject.h 1007 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* Tuple object interface */
  2. #ifndef Py_TUPLEOBJECT_H
  3. #define Py_TUPLEOBJECT_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef struct {
  8. PyObject_VAR_HEAD
  9. PyObject *ob_item[1];
  10. /* ob_item contains space for 'ob_size' elements.
  11. * Items must normally not be NULL, except during construction when
  12. * the tuple is not yet visible outside the function that builds it.
  13. */
  14. } PyTupleObject;
  15. /* defined in varargswrapper.c */
  16. PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...);
  17. /* Macro, trading safety for speed */
  18. #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i])
  19. #define PyTuple_GET_SIZE(op) Py_SIZE(op)
  20. /* Macro, *only* to be used to fill in brand new tuples */
  21. #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
  22. #define PyTuple_Check(op) \
  23. PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_TUPLE_SUBCLASS)
  24. #define PyTuple_CheckExact(op) ((op)->ob_type == &PyTuple_Type)
  25. #ifdef __cplusplus
  26. }
  27. #endif
  28. #endif /* !Py_TUPLEOBJECT_H */