diff options
author | Yury Selivanov <yury@magic.io> | 2016-09-08 22:01:51 -0700 |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-09-08 22:01:51 -0700 |
commit | 17668cfa5e0e6f50376cc233d9b063b908a19845 (patch) | |
tree | 57bc17cf714ed2583b6b9aacdfb38294a2c16fe7 /Include/genobject.h | |
parent | a360bf1bc1331830525d228d1cba50162bb78c79 (diff) | |
download | cpython-17668cfa5e0e6f50376cc233d9b063b908a19845.tar.gz |
Issue #28003: Implement PEP 525 -- Asynchronous Generators.
Diffstat (limited to 'Include/genobject.h')
-rw-r--r-- | Include/genobject.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Include/genobject.h b/Include/genobject.h index 1ff32a8eaf..973bdd5f56 100644 --- a/Include/genobject.h +++ b/Include/genobject.h @@ -61,6 +61,37 @@ PyObject *_PyAIterWrapper_New(PyObject *aiter); PyObject *_PyCoro_GetAwaitableIter(PyObject *o); PyAPI_FUNC(PyObject *) PyCoro_New(struct _frame *, PyObject *name, PyObject *qualname); + +/* Asynchronous Generators */ + +typedef struct { + _PyGenObject_HEAD(ag) + PyObject *ag_finalizer; + + /* Flag is set to 1 when hooks set up by sys.set_asyncgen_hooks + were called on the generator, to avoid calling them more + than once. */ + int ag_hooks_inited; + + /* Flag is set to 1 when aclose() is called for the first time, or + when a StopAsyncIteration exception is raised. */ + int ag_closed; +} PyAsyncGenObject; + +PyAPI_DATA(PyTypeObject) PyAsyncGen_Type; +PyAPI_DATA(PyTypeObject) _PyAsyncGenASend_Type; +PyAPI_DATA(PyTypeObject) _PyAsyncGenWrappedValue_Type; +PyAPI_DATA(PyTypeObject) _PyAsyncGenAThrow_Type; + +PyAPI_FUNC(PyObject *) PyAsyncGen_New(struct _frame *, + PyObject *name, PyObject *qualname); + +#define PyAsyncGen_CheckExact(op) (Py_TYPE(op) == &PyAsyncGen_Type) + +PyObject *_PyAsyncGenValueWrapperNew(PyObject *); + +int PyAsyncGen_ClearFreeLists(void); + #endif #undef _PyGenObject_HEAD |