PEP 0492 -- Coroutines with async and await syntax. Issue #24017.
diff --git a/Include/object.h b/Include/object.h
index 5716f66..e173438 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -173,6 +173,9 @@
typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *);
typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *);
+typedef PyObject *(*getawaitablefunc) (PyObject *);
+typedef PyObject *(*getaiterfunc) (PyObject *);
+typedef PyObject *(*aiternextfunc) (PyObject *);
#ifndef Py_LIMITED_API
/* buffer interface */
@@ -301,6 +304,11 @@
objobjargproc mp_ass_subscript;
} PyMappingMethods;
+typedef struct {
+ getawaitablefunc am_await;
+ getaiterfunc am_aiter;
+ aiternextfunc am_anext;
+} PyAsyncMethods;
typedef struct {
getbufferproc bf_getbuffer;
@@ -346,7 +354,7 @@
printfunc tp_print;
getattrfunc tp_getattr;
setattrfunc tp_setattr;
- void *tp_reserved; /* formerly known as tp_compare */
+ PyAsyncMethods *tp_as_async; /* formerly known as tp_compare or tp_reserved */
reprfunc tp_repr;
/* Method suites for standard classes */
@@ -453,6 +461,7 @@
/* Note: there's a dependency on the order of these members
in slotptr() in typeobject.c . */
PyTypeObject ht_type;
+ PyAsyncMethods as_async;
PyNumberMethods as_number;
PyMappingMethods as_mapping;
PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,