| 1 | #ifndef Py_GENOBJECT_H |
| 2 | #define Py_GENOBJECT_H |
| 3 | #ifdef __cplusplus |
| 4 | extern "C" { |
| 5 | #endif |
| 6 | |
| 7 | struct _frame; /* Avoid including frameobject.h */ |
| 8 | |
| 9 | typedef struct { |
| 10 | PyObject_HEAD |
| 11 | /* The gi_ prefix is intended to remind of generator-iterator. */ |
| 12 | |
| 13 | struct _frame *gi_frame; |
| 14 | |
| 15 | /* True if generator is being executed. */ |
| 16 | int gi_running; |
| 17 | |
| 18 | /* List of weak reference. */ |
| 19 | PyObject *gi_weakreflist; |
| 20 | } PyGenObject; |
| 21 | |
| 22 | PyAPI_DATA(PyTypeObject) PyGen_Type; |
| 23 | |
| 24 | #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) |
| 25 | #define PyGen_CheckExact(op) ((op)->ob_type == &PyGen_Type) |
| 26 | |
| 27 | PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); |
| 28 | |
| 29 | #ifdef __cplusplus |
| 30 | } |
| 31 | #endif |
| 32 | #endif /* !Py_GENOBJECT_H */ |