Commit c1706e6a authored by Stefan Behnel's avatar Stefan Behnel

Generate short wrappers for "__await__()" special method to adapt its...

Generate short wrappers for "__await__()" special method to adapt its signature for the PyCFunction entry in PyMethodDef.
See #2363.
parent 9e183145
...@@ -1458,6 +1458,12 @@ static CYTHON_INLINE PyObject *__Pyx__Coroutine_await(PyObject *coroutine) { ...@@ -1458,6 +1458,12 @@ static CYTHON_INLINE PyObject *__Pyx__Coroutine_await(PyObject *coroutine) {
return (PyObject*)await; return (PyObject*)await;
} }
#if PY_VERSION_HEX < 0x030500B1
static PyObject *__Pyx_Coroutine_await_method(PyObject *coroutine, CYTHON_UNUSED PyObject *arg) {
return __Pyx__Coroutine_await(coroutine);
}
#endif
static PyObject *__Pyx_Coroutine_await(PyObject *coroutine) { static PyObject *__Pyx_Coroutine_await(PyObject *coroutine) {
if (unlikely(!coroutine || !__Pyx_Coroutine_Check(coroutine))) { if (unlikely(!coroutine || !__Pyx_Coroutine_Check(coroutine))) {
PyErr_SetString(PyExc_TypeError, "invalid input, expected coroutine"); PyErr_SetString(PyExc_TypeError, "invalid input, expected coroutine");
...@@ -1495,7 +1501,7 @@ static PyMethodDef __pyx_Coroutine_methods[] = { ...@@ -1495,7 +1501,7 @@ static PyMethodDef __pyx_Coroutine_methods[] = {
{"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
(char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")}, (char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
#if PY_VERSION_HEX < 0x030500B1 #if PY_VERSION_HEX < 0x030500B1
{"__await__", (PyCFunction) __Pyx_Coroutine_await, METH_NOARGS, {"__await__", (PyCFunction) __Pyx_Coroutine_await_method, METH_NOARGS,
(char*) PyDoc_STR("__await__() -> return an iterator to be used in await expression.")}, (char*) PyDoc_STR("__await__() -> return an iterator to be used in await expression.")},
#endif #endif
{0, 0, 0, 0} {0, 0, 0, 0}
......
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