genobject.h 931 B

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