| 1 |
/* Generator object interface */ |
| 2 |
|
| 3 |
#ifndef Py_LIMITED_API |
| 4 |
#ifndef Py_GENOBJECT_H |
| 5 |
#define Py_GENOBJECT_H |
| 6 |
#ifdef __cplusplus |
| 7 |
extern "C" { |
| 8 |
#endif |
| 9 |
|
| 10 |
/* --- Generators --------------------------------------------------------- */ |
| 11 |
|
| 12 |
typedef struct _PyGenObject PyGenObject; |
| 13 |
|
| 14 |
PyAPI_DATA(PyTypeObject) PyGen_Type; |
| 15 |
|
| 16 |
#define PyGen_Check(op) PyObject_TypeCheck((op), &PyGen_Type) |
| 17 |
#define PyGen_CheckExact(op) Py_IS_TYPE((op), &PyGen_Type) |
| 18 |
|
| 19 |
PyAPI_FUNC(PyObject *) PyGen_New(PyFrameObject *); |
| 20 |
PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(PyFrameObject *, |
| 21 |
PyObject *name, PyObject *qualname); |
| 22 |
PyAPI_FUNC(PyCodeObject *) PyGen_GetCode(PyGenObject *gen); |
| 23 |
|
| 24 |
|
| 25 |
/* --- PyCoroObject ------------------------------------------------------- */ |
| 26 |
|
| 27 |
typedef struct _PyCoroObject PyCoroObject; |
| 28 |
|
| 29 |
PyAPI_DATA(PyTypeObject) PyCoro_Type; |
| 30 |
|
| 31 |
#define PyCoro_CheckExact(op) Py_IS_TYPE((op), &PyCoro_Type) |
| 32 |
PyAPI_FUNC(PyObject *) PyCoro_New(PyFrameObject *, |
| 33 |
PyObject *name, PyObject *qualname); |
| 34 |
|
| 35 |
|
| 36 |
/* --- Asynchronous Generators -------------------------------------------- */ |
| 37 |
|
| 38 |
typedef struct _PyAsyncGenObject PyAsyncGenObject; |
| 39 |
|
| 40 |
PyAPI_DATA(PyTypeObject) PyAsyncGen_Type; |
| 41 |
PyAPI_DATA(PyTypeObject) _PyAsyncGenASend_Type; |
| 42 |
|
| 43 |
PyAPI_FUNC(PyObject *) PyAsyncGen_New(PyFrameObject *, |
| 44 |
PyObject *name, PyObject *qualname); |
| 45 |
|
| 46 |
#define PyAsyncGen_CheckExact(op) Py_IS_TYPE((op), &PyAsyncGen_Type) |
| 47 |
|
| 48 |
#define PyAsyncGenASend_CheckExact(op) Py_IS_TYPE((op), &_PyAsyncGenASend_Type) |
| 49 |
|
| 50 |
#undef _PyGenObject_HEAD |
| 51 |
|
| 52 |
#ifdef __cplusplus |
| 53 |
} |
| 54 |
#endif |
| 55 |
#endif /* !Py_GENOBJECT_H */ |
| 56 |
#endif /* Py_LIMITED_API */ |