Coroutine Objects

3.5 版新加入.

Coroutine objects are what functions declared with an async keyword return.

PyCoroObject

The C structure used for coroutine objects.

PyTypeObject PyCoro_Type

The type object corresponding to coroutine objects.

int PyCoro_CheckExact(PyObject *ob)

如果 ob 的类型是 PyCoro_Type 则返回真值;ob 必须不为 NULL

PyObject* PyCoro_New(PyFrameObject *frame, PyObject *name, PyObject *qualname)
Return value: New reference.

基于 frame 对象创建并返回一个新的协程对象,其中 __name____qualname__ 设为 namequalname。 此函数会取得一个对 frame 的引用。 frame 参数必须不为 NULL