You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.1 KiB

14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
  1. /* Generator object interface */
  2. #ifndef Py_LIMITED_API
  3. #ifndef Py_GENOBJECT_H
  4. #define Py_GENOBJECT_H
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. struct _frame; /* Avoid including frameobject.h */
  9. typedef struct {
  10. PyObject_HEAD
  11. /* The gi_ prefix is intended to remind of generator-iterator. */
  12. /* Note: gi_frame can be NULL if the generator is "finished" */
  13. struct _frame *gi_frame;
  14. /* True if generator is being executed. */
  15. char gi_running;
  16. /* The code object backing the generator */
  17. PyObject *gi_code;
  18. /* List of weak reference. */
  19. PyObject *gi_weakreflist;
  20. } PyGenObject;
  21. PyAPI_DATA(PyTypeObject) PyGen_Type;
  22. #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
  23. #define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type)
  24. PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
  25. PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);
  26. PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
  27. PyObject *_PyGen_Send(PyGenObject *, PyObject *);
  28. PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
  29. #ifdef __cplusplus
  30. }
  31. #endif
  32. #endif /* !Py_GENOBJECT_H */
  33. #endif /* Py_LIMITED_API */