Commit 612363c7 authored by Stefan Behnel's avatar Stefan Behnel

Fix incorrect method unpacking code in coroutine finalisation code.

parent 6ca9672c
......@@ -223,19 +223,20 @@ __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o)
firstiter = tstate->async_gen_firstiter;
if (firstiter) {
PyObject *res;
#if CYTHON_UNPACK_METHODS
PyObject *self;
#endif
Py_INCREF(firstiter);
// at least asyncio stores methods here => optimise the call
#if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(firstiter))) {
PyObject *self = PyMethod_GET_SELF(firstiter);
if (likely(self)) {
PyObject *function = PyMethod_GET_FUNCTION(firstiter);
return __Pyx_PyObject_Call2Args(function, self, (PyObject*)o);
}
}
if (likely(PyMethod_Check(firstiter)) && likely((self = PyMethod_GET_SELF(firstiter)) != NULL)) {
PyObject *function = PyMethod_GET_FUNCTION(firstiter);
res = __Pyx_PyObject_Call2Args(function, self, (PyObject*)o);
} else
#endif
res = __Pyx_PyObject_CallOneArg(firstiter, (PyObject*)o);
Py_DECREF(firstiter);
if (unlikely(res == NULL)) {
return 1;
......
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