/Include/genobject.h

http://unladen-swallow.googlecode.com/ · C++ Header · 40 lines · 22 code · 12 blank · 6 comment · 1 complexity · c364ad706081c6f64a693ffdbadc7a33 MD5 · raw file

  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 */