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