Commit 691eabf9 authored by Stefan Behnel's avatar Stefan Behnel

Optimise internal fallback method call to ".__await__()" in Py3.7+ by directly...

Optimise internal fallback method call to ".__await__()" in Py3.7+ by directly unpacking the method instance.
parent d6f1be73
...@@ -194,6 +194,14 @@ static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) { ...@@ -194,6 +194,14 @@ static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) {
PyObject *method = NULL; PyObject *method = NULL;
int is_method = __Pyx_PyObject_GetMethod(obj, PYIDENT("__await__"), &method); int is_method = __Pyx_PyObject_GetMethod(obj, PYIDENT("__await__"), &method);
if (likely(is_method)) { if (likely(is_method)) {
#if PY_VERSION_HEX >= 0x030700A1 && CYTHON_UNPACK_METHODS && CYTHON_FAST_PYCCALL
if (Py_TYPE(method) == &PyMethodDescr_Type) {
PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
res = _PyMethodDef_RawFastCallKeywords(descr->d_method, obj, NULL, 0, NULL);
if (unlikely(!res))
res = _Py_CheckFunctionResult(obj, res, NULL);
} else
#endif
res = __Pyx_PyObject_CallOneArg(method, obj); res = __Pyx_PyObject_CallOneArg(method, obj);
} else if (likely(method)) { } else if (likely(method)) {
res = __Pyx_PyObject_CallNoArg(method); res = __Pyx_PyObject_CallNoArg(method);
......
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