Commit dee2a0cb authored by Stefan Behnel's avatar Stefan Behnel

implement shortcuts for async generators in async-for loop

parent 0c815f07
......@@ -19,6 +19,7 @@ static PyTypeObject *__pyx__PyAsyncGenAThrowType = 0;
static PyTypeObject *__pyx_AsyncGenType = 0;
#define __Pyx_AsyncGen_CheckExact(obj) (Py_TYPE(obj) == __pyx_AsyncGenType)
static PyObject *__Pyx_AsyncGen_ANext(PyObject *o);
static __pyx_CoroutineObject *__Pyx_AsyncGen_New(
__pyx_coroutine_body_t body, PyObject *closure,
......@@ -208,8 +209,9 @@ __Pyx_async_gen_init_finalizer(__pyx_AsyncGenObject *o)
static PyObject *
__Pyx_async_gen_anext(__pyx_AsyncGenObject *o)
__Pyx_AsyncGen_ANext(PyObject *self)
{
__pyx_AsyncGenObject *o = (__pyx_AsyncGenObject *)self;
if (__Pyx_async_gen_init_finalizer(o)) {
return NULL;
}
......@@ -286,7 +288,7 @@ static PyMethodDef __Pyx_async_gen_methods[] = {
static PyAsyncMethods __Pyx_async_gen_as_async = {
0, /* am_await */
PyObject_SelfIter, /* am_aiter */
(unaryfunc)__Pyx_async_gen_anext /* am_anext */
(unaryfunc)__Pyx_AsyncGen_ANext /* am_anext */
};
......
......@@ -170,8 +170,7 @@ static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *o); /*proto*/
static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o) {
#ifdef __Pyx_Coroutine_USED
if (__Pyx_Coroutine_CheckExact(o)) {
Py_INCREF(o);
return o;
return __Pyx_NewRef(o);
}
#endif
return __Pyx__Coroutine_GetAwaitableIter(o);
......@@ -257,11 +256,18 @@ static CYTHON_INLINE PyObject *__Pyx_Coroutine_AsyncIterNext(PyObject *o); /*pro
//@requires: ObjectHandling.c::PyObjectCallMethod0
static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAsyncIter(PyObject *obj) {
#ifdef __Pyx_AsyncGen_USED
if (__Pyx_AsyncGen_CheckExact(obj)) {
return __Pyx_NewRef(obj);
}
#endif
#if CYTHON_USE_ASYNC_SLOTS
{
__Pyx_PyAsyncMethodsStruct* am = __Pyx_PyType_AsAsync(obj);
if (likely(am && am->am_aiter)) {
return (*am->am_aiter)(obj);
}
}
#endif
#if PY_VERSION_HEX < 0x030500B1
{
......@@ -282,12 +288,20 @@ static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAsyncIter(PyObject *obj) {
return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_Coroutine_AsyncIterNext(PyObject *obj) {
#ifdef __Pyx_AsyncGen_USED
if (__Pyx_AsyncGen_CheckExact(obj)) {
return __Pyx_AsyncGen_ANext(obj);
}
#endif
#if CYTHON_USE_ASYNC_SLOTS
{
__Pyx_PyAsyncMethodsStruct* am = __Pyx_PyType_AsAsync(obj);
if (likely(am && am->am_anext)) {
return (*am->am_anext)(obj);
}
}
#endif
#if PY_VERSION_HEX < 0x030500B1
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment