C API for asynchronous functions

See @ZeroIntensity’s proposal: Revisiting a C API for asynchronous functions. It spells this METH_ASYNC rather than METH_COROUTINE, but otherwise it is what you ask for.

But, I think that a flag for PyMethodDef is a quality-of-life improvement that should be added on top of a proven, working, popular mechanism. It’s a goal to aim for, but not something to do right now. (Compare how asyncio used generators for a while before async/await was added to the language.)

1 Like