Commit 2d466332 authored by Stefan Behnel's avatar Stefan Behnel

optimise call to asyncio "firstiter" method for async generators

parent 49d0e464
......@@ -100,6 +100,7 @@ static int __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o) {
//////////////////// AsyncGenerator ////////////////////
//@requires: AsyncGeneratorInitFinalizer
//@requires: Coroutine.c::Coroutine
//@requires: ObjectHandling.c::PyObjectCallMethod1
PyDoc_STRVAR(__Pyx_async_gen_send_doc,
......@@ -222,7 +223,8 @@ __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o)
PyObject *res;
Py_INCREF(firstiter);
res = __Pyx_PyObject_CallOneArg(firstiter, (PyObject*)o);
// at least asyncio stores methods here => optimise the call
res = __Pyx__PyObject_CallMethod1(firstiter, (PyObject*)o);
Py_DECREF(firstiter);
if (unlikely(res == NULL)) {
return 1;
......
......@@ -1268,6 +1268,7 @@ bad:
/////////////// PyObjectCallMethod1.proto ///////////////
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); /*proto*/
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg); /*proto*/
/////////////// PyObjectCallMethod1 ///////////////
//@requires: PyObjectGetAttrStr
......@@ -1275,10 +1276,8 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
//@requires: PyFunctionFastCall
//@requires: PyCFunctionFastCall
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
PyObject *method, *result = NULL;
method = __Pyx_PyObject_GetAttrStr(obj, method_name);
if (unlikely(!method)) goto done;
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
PyObject *result;
#if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(method))) {
PyObject *self = PyMethod_GET_SELF(method);
......@@ -1315,6 +1314,15 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
}
#endif
result = __Pyx_PyObject_CallOneArg(method, arg);
done:
return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
PyObject *method, *result;
method = __Pyx_PyObject_GetAttrStr(obj, method_name);
if (unlikely(!method)) goto done;
result = __Pyx__PyObject_CallMethod1(method, arg);
done:
Py_XDECREF(method);
return result;
......
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