#ifndef Py_BUILD_CORE_BUILTIN #define Py_BUILD_CORE_MODULE … #endif #include "Python.h" #include "pycore_critical_section.h" // Py_BEGIN_CRITICAL_SECTION_MUT() #include "pycore_dict.h" // _PyDict_GetItem_KnownHash() #include "pycore_freelist.h" // _Py_FREELIST_POP() #include "pycore_modsupport.h" // _PyArg_CheckPositional() #include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_object.h" // _Py_SetImmortalUntracked() #include "pycore_pyerrors.h" // _PyErr_ClearExcState() #include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing() #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_runtime_init.h" // _Py_ID() #include <stddef.h> // offsetof() /*[clinic input] module _asyncio [clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=8fd17862aa989c69]*/ fut_state; #define FutureObj_HEAD(prefix) … FutureObj; TaskObj; TaskStepMethWrapper; #define Future_CheckExact(state, obj) … #define Task_CheckExact(state, obj) … #define Future_Check(state, obj) … #define Task_Check(state, obj) … #ifdef Py_GIL_DISABLED #define ASYNCIO_STATE_LOCK … #define ASYNCIO_STATE_UNLOCK … #else #define ASYNCIO_STATE_LOCK(state) … #define ASYNCIO_STATE_UNLOCK(state) … #endif /* State of the _asyncio module */ asyncio_state; static inline asyncio_state * get_asyncio_state(PyObject *mod) { … } static inline asyncio_state * get_asyncio_state_by_cls(PyTypeObject *cls) { … } static struct PyModuleDef _asynciomodule; static inline asyncio_state * get_asyncio_state_by_def(PyObject *self) { … } #include "clinic/_asynciomodule.c.h" /*[clinic input] class _asyncio.Future "FutureObj *" "&Future_Type" [clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=00d3e4abca711e0f]*/ /* Get FutureIter from Future */ static PyObject * future_new_iter(PyObject *); static PyObject * task_step_handle_result_impl(asyncio_state *state, TaskObj *task, PyObject *result); static int _is_coroutine(asyncio_state *state, PyObject *coro) { … } static inline int is_coroutine(asyncio_state *state, PyObject *coro) { … } static PyObject * get_future_loop(asyncio_state *state, PyObject *fut) { … } static PyObject * get_event_loop(asyncio_state *state) { … } static int call_soon(asyncio_state *state, PyObject *loop, PyObject *func, PyObject *arg, PyObject *ctx) { … } static inline int future_is_alive(FutureObj *fut) { … } static inline int future_ensure_alive(FutureObj *fut) { … } #define ENSURE_FUTURE_ALIVE(state, fut) … static int future_schedule_callbacks(asyncio_state *state, FutureObj *fut) { … } static int future_init(FutureObj *fut, PyObject *loop) { … } static PyObject * future_set_result(asyncio_state *state, FutureObj *fut, PyObject *res) { … } static PyObject * future_set_exception(asyncio_state *state, FutureObj *fut, PyObject *exc) { … } static PyObject * create_cancelled_error(asyncio_state *state, FutureObj *fut) { … } static void future_set_cancelled_error(asyncio_state *state, FutureObj *fut) { … } static int future_get_result(asyncio_state *state, FutureObj *fut, PyObject **result) { … } static PyObject * future_add_done_callback(asyncio_state *state, FutureObj *fut, PyObject *arg, PyObject *ctx) { … } static PyObject * future_cancel(asyncio_state *state, FutureObj *fut, PyObject *msg) { … } /*[clinic input] _asyncio.Future.__init__ * loop: object = None This class is *almost* compatible with concurrent.futures.Future. Differences: - result() and exception() do not take a timeout argument and raise an exception when the future isn't done yet. - Callbacks registered with add_done_callback() are always called via the event loop's call_soon_threadsafe(). - This class is not compatible with the wait() and as_completed() methods in the concurrent.futures package. [clinic start generated code]*/ static int _asyncio_Future___init___impl(FutureObj *self, PyObject *loop) /*[clinic end generated code: output=9ed75799eaccb5d6 input=89af317082bc0bf8]*/ { … } static int FutureObj_clear(FutureObj *fut) { … } static int FutureObj_traverse(FutureObj *fut, visitproc visit, void *arg) { … } /*[clinic input] _asyncio.Future.result Return the result this future represents. If the future has been cancelled, raises CancelledError. If the future's result isn't yet available, raises InvalidStateError. If the future is done and has an exception set, this exception is raised. [clinic start generated code]*/ static PyObject * _asyncio_Future_result_impl(FutureObj *self) /*[clinic end generated code: output=f35f940936a4b1e5 input=49ecf9cf5ec50dc5]*/ { … } /*[clinic input] _asyncio.Future.exception cls: defining_class / Return the exception that was set on this future. The exception (or None if no exception was set) is returned only if the future is done. If the future has been cancelled, raises CancelledError. If the future isn't done yet, raises InvalidStateError. [clinic start generated code]*/ static PyObject * _asyncio_Future_exception_impl(FutureObj *self, PyTypeObject *cls) /*[clinic end generated code: output=ce75576b187c905b input=3faf15c22acdb60d]*/ { … } /*[clinic input] _asyncio.Future.set_result cls: defining_class result: object / Mark the future done and set its result. If the future is already done when this method is called, raises InvalidStateError. [clinic start generated code]*/ static PyObject * _asyncio_Future_set_result_impl(FutureObj *self, PyTypeObject *cls, PyObject *result) /*[clinic end generated code: output=99afbbe78f99c32d input=d5a41c1e353acc2e]*/ { … } /*[clinic input] _asyncio.Future.set_exception cls: defining_class exception: object / Mark the future done and set an exception. If the future is already done when this method is called, raises InvalidStateError. [clinic start generated code]*/ static PyObject * _asyncio_Future_set_exception_impl(FutureObj *self, PyTypeObject *cls, PyObject *exception) /*[clinic end generated code: output=0a5e8b5a52f058d6 input=a245cd49d3df939b]*/ { … } /*[clinic input] _asyncio.Future.add_done_callback cls: defining_class fn: object / * context: object = NULL Add a callback to be run when the future becomes done. The callback is called with a single argument - the future object. If the future is already done when this is called, the callback is scheduled with call_soon. [clinic start generated code]*/ static PyObject * _asyncio_Future_add_done_callback_impl(FutureObj *self, PyTypeObject *cls, PyObject *fn, PyObject *context) /*[clinic end generated code: output=922e9a4cbd601167 input=599261c521458cc2]*/ { … } /*[clinic input] _asyncio.Future.remove_done_callback cls: defining_class fn: object / Remove all instances of a callback from the "call when done" list. Returns the number of callbacks removed. [clinic start generated code]*/ static PyObject * _asyncio_Future_remove_done_callback_impl(FutureObj *self, PyTypeObject *cls, PyObject *fn) /*[clinic end generated code: output=2da35ccabfe41b98 input=c7518709b86fc747]*/ { … } /*[clinic input] _asyncio.Future.cancel cls: defining_class / msg: object = None Cancel the future and schedule callbacks. If the future is already done or cancelled, return False. Otherwise, change the future's state to cancelled, schedule the callbacks and return True. [clinic start generated code]*/ static PyObject * _asyncio_Future_cancel_impl(FutureObj *self, PyTypeObject *cls, PyObject *msg) /*[clinic end generated code: output=074956f35904b034 input=bba8f8b786941a94]*/ { … } /*[clinic input] _asyncio.Future.cancelled Return True if the future was cancelled. [clinic start generated code]*/ static PyObject * _asyncio_Future_cancelled_impl(FutureObj *self) /*[clinic end generated code: output=145197ced586357d input=943ab8b7b7b17e45]*/ { … } /*[clinic input] _asyncio.Future.done Return True if the future is done. Done means either that a result / exception are available, or that the future was cancelled. [clinic start generated code]*/ static PyObject * _asyncio_Future_done_impl(FutureObj *self) /*[clinic end generated code: output=244c5ac351145096 input=28d7b23fdb65d2ac]*/ { … } /*[clinic input] _asyncio.Future.get_loop cls: defining_class / Return the event loop the Future is bound to. [clinic start generated code]*/ static PyObject * _asyncio_Future_get_loop_impl(FutureObj *self, PyTypeObject *cls) /*[clinic end generated code: output=f50ea6c374d9ee97 input=163c2c498b45a1f0]*/ { … } static PyObject * FutureObj_get_blocking(FutureObj *fut, void *Py_UNUSED(ignored)) { … } static int FutureObj_set_blocking(FutureObj *fut, PyObject *val, void *Py_UNUSED(ignored)) { … } static PyObject * FutureObj_get_log_traceback(FutureObj *fut, void *Py_UNUSED(ignored)) { … } static int FutureObj_set_log_traceback(FutureObj *fut, PyObject *val, void *Py_UNUSED(ignored)) { … } static PyObject * FutureObj_get_loop(FutureObj *fut, void *Py_UNUSED(ignored)) { … } static PyObject * FutureObj_get_callbacks(FutureObj *fut, void *Py_UNUSED(ignored)) { … } static PyObject * FutureObj_get_result(FutureObj *fut, void *Py_UNUSED(ignored)) { … } static PyObject * FutureObj_get_exception(FutureObj *fut, void *Py_UNUSED(ignored)) { … } static PyObject * FutureObj_get_source_traceback(FutureObj *fut, void *Py_UNUSED(ignored)) { … } static PyObject * FutureObj_get_cancel_message(FutureObj *fut, void *Py_UNUSED(ignored)) { … } static int FutureObj_set_cancel_message(FutureObj *fut, PyObject *msg, void *Py_UNUSED(ignored)) { … } static PyObject * FutureObj_get_state(FutureObj *fut, void *Py_UNUSED(ignored)) { … } static PyObject * FutureObj_repr(FutureObj *fut) { … } /*[clinic input] _asyncio.Future._make_cancelled_error Create the CancelledError to raise if the Future is cancelled. This should only be called once when handling a cancellation since it erases the context exception value. [clinic start generated code]*/ static PyObject * _asyncio_Future__make_cancelled_error_impl(FutureObj *self) /*[clinic end generated code: output=a5df276f6c1213de input=ac6effe4ba795ecc]*/ { … } static void FutureObj_finalize(FutureObj *fut) { … } static PyMethodDef FutureType_methods[] = …; #define FUTURE_COMMON_GETSETLIST … static PyGetSetDef FutureType_getsetlist[] = …; static void FutureObj_dealloc(PyObject *self); static PyType_Slot Future_slots[] = …; static PyType_Spec Future_spec = …; static void FutureObj_dealloc(PyObject *self) { … } /*********************** Future Iterator **************************/ futureiterobject; static void FutureIter_dealloc(futureiterobject *it) { … } static PySendResult FutureIter_am_send(futureiterobject *it, PyObject *Py_UNUSED(arg), PyObject **result) { … } static PyObject * FutureIter_iternext(futureiterobject *it) { … } static PyObject * FutureIter_send(futureiterobject *self, PyObject *unused) { … } static PyObject * FutureIter_throw(futureiterobject *self, PyObject *const *args, Py_ssize_t nargs) { … } static int FutureIter_clear(futureiterobject *it) { … } static PyObject * FutureIter_close(futureiterobject *self, PyObject *arg) { … } static int FutureIter_traverse(futureiterobject *it, visitproc visit, void *arg) { … } static PyMethodDef FutureIter_methods[] = …; static PyType_Slot FutureIter_slots[] = …; static PyType_Spec FutureIter_spec = …; static PyObject * future_new_iter(PyObject *fut) { … } /*********************** Task **************************/ /*[clinic input] class _asyncio.Task "TaskObj *" "&Task_Type" [clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=719dcef0fcc03b37]*/ static int task_call_step_soon(asyncio_state *state, TaskObj *, PyObject *); static PyObject * task_wakeup(TaskObj *, PyObject *); static PyObject * task_step(asyncio_state *, TaskObj *, PyObject *); static int task_eager_start(asyncio_state *state, TaskObj *task); /* ----- Task._step wrapper */ static int TaskStepMethWrapper_clear(TaskStepMethWrapper *o) { … } static void TaskStepMethWrapper_dealloc(TaskStepMethWrapper *o) { … } static PyObject * TaskStepMethWrapper_call(TaskStepMethWrapper *o, PyObject *args, PyObject *kwds) { … } static int TaskStepMethWrapper_traverse(TaskStepMethWrapper *o, visitproc visit, void *arg) { … } static PyObject * TaskStepMethWrapper_get___self__(TaskStepMethWrapper *o, void *Py_UNUSED(ignored)) { … } static PyGetSetDef TaskStepMethWrapper_getsetlist[] = …; static PyType_Slot TaskStepMethWrapper_slots[] = …; static PyType_Spec TaskStepMethWrapper_spec = …; static PyObject * TaskStepMethWrapper_new(TaskObj *task, PyObject *arg) { … } /* ----- Task._wakeup implementation */ static PyMethodDef TaskWakeupDef = …; /* ----- Task introspection helpers */ static void register_task(asyncio_state *state, TaskObj *task) { … } static int register_eager_task(asyncio_state *state, PyObject *task) { … } static void unregister_task(asyncio_state *state, TaskObj *task) { … } static int unregister_eager_task(asyncio_state *state, PyObject *task) { … } static int enter_task(asyncio_state *state, PyObject *loop, PyObject *task) { … } static int err_leave_task(PyObject *item, PyObject *task) { … } static int leave_task_predicate(PyObject *item, void *task) { … } static int leave_task(asyncio_state *state, PyObject *loop, PyObject *task) /*[clinic end generated code: output=0ebf6db4b858fb41 input=51296a46313d1ad8]*/ { … } static PyObject * swap_current_task_lock_held(PyDictObject *current_tasks, PyObject *loop, Py_hash_t hash, PyObject *task) { … } static PyObject * swap_current_task(asyncio_state *state, PyObject *loop, PyObject *task) { … } /* ----- Task */ /*[clinic input] _asyncio.Task.__init__ coro: object * loop: object = None name: object = None context: object = None eager_start: bool = False A coroutine wrapped in a Future. [clinic start generated code]*/ static int _asyncio_Task___init___impl(TaskObj *self, PyObject *coro, PyObject *loop, PyObject *name, PyObject *context, int eager_start) /*[clinic end generated code: output=7aced2d27836f1a1 input=18e3f113a51b829d]*/ { … } static int TaskObj_clear(TaskObj *task) { … } static int TaskObj_traverse(TaskObj *task, visitproc visit, void *arg) { … } static PyObject * TaskObj_get_log_destroy_pending(TaskObj *task, void *Py_UNUSED(ignored)) { … } static int TaskObj_set_log_destroy_pending(TaskObj *task, PyObject *val, void *Py_UNUSED(ignored)) { … } static PyObject * TaskObj_get_must_cancel(TaskObj *task, void *Py_UNUSED(ignored)) { … } static PyObject * TaskObj_get_coro(TaskObj *task, void *Py_UNUSED(ignored)) { … } static PyObject * TaskObj_get_fut_waiter(TaskObj *task, void *Py_UNUSED(ignored)) { … } static PyObject * TaskObj_repr(TaskObj *task) { … } /*[clinic input] _asyncio.Task._make_cancelled_error Create the CancelledError to raise if the Task is cancelled. This should only be called once when handling a cancellation since it erases the context exception value. [clinic start generated code]*/ static PyObject * _asyncio_Task__make_cancelled_error_impl(TaskObj *self) /*[clinic end generated code: output=55a819e8b4276fab input=52c0e32de8e2f840]*/ { … } /*[clinic input] _asyncio.Task.cancel msg: object = None Request that this task cancel itself. This arranges for a CancelledError to be thrown into the wrapped coroutine on the next cycle through the event loop. The coroutine then has a chance to clean up or even deny the request using try/except/finally. Unlike Future.cancel, this does not guarantee that the task will be cancelled: the exception might be caught and acted upon, delaying cancellation of the task or preventing cancellation completely. The task may also return a value or raise a different exception. Immediately after this method is called, Task.cancelled() will not return True (unless the task was already cancelled). A task will be marked as cancelled when the wrapped coroutine terminates with a CancelledError exception (even if cancel() was not called). This also increases the task's count of cancellation requests. [clinic start generated code]*/ static PyObject * _asyncio_Task_cancel_impl(TaskObj *self, PyObject *msg) /*[clinic end generated code: output=c66b60d41c74f9f1 input=7bb51bf25974c783]*/ { … } /*[clinic input] _asyncio.Task.cancelling Return the count of the task's cancellation requests. This count is incremented when .cancel() is called and may be decremented using .uncancel(). [clinic start generated code]*/ static PyObject * _asyncio_Task_cancelling_impl(TaskObj *self) /*[clinic end generated code: output=803b3af96f917d7e input=b625224d310cbb17]*/ /*[clinic end generated code]*/ { … } /*[clinic input] _asyncio.Task.uncancel Decrement the task's count of cancellation requests. This should be used by tasks that catch CancelledError and wish to continue indefinitely until they are cancelled again. Returns the remaining number of cancellation requests. [clinic start generated code]*/ static PyObject * _asyncio_Task_uncancel_impl(TaskObj *self) /*[clinic end generated code: output=58184d236a817d3c input=68f81a4b90b46be2]*/ /*[clinic end generated code]*/ { … } /*[clinic input] _asyncio.Task.get_stack cls: defining_class / * limit: object = None Return the list of stack frames for this task's coroutine. If the coroutine is not done, this returns the stack where it is suspended. If the coroutine has completed successfully or was cancelled, this returns an empty list. If the coroutine was terminated by an exception, this returns the list of traceback frames. The frames are always ordered from oldest to newest. The optional limit gives the maximum number of frames to return; by default all available frames are returned. Its meaning differs depending on whether a stack or a traceback is returned: the newest frames of a stack are returned, but the oldest frames of a traceback are returned. (This matches the behavior of the traceback module.) For reasons beyond our control, only one stack frame is returned for a suspended coroutine. [clinic start generated code]*/ static PyObject * _asyncio_Task_get_stack_impl(TaskObj *self, PyTypeObject *cls, PyObject *limit) /*[clinic end generated code: output=6774dfc10d3857fa input=8e01c9b2618ae953]*/ { … } /*[clinic input] _asyncio.Task.print_stack cls: defining_class / * limit: object = None file: object = None Print the stack or traceback for this task's coroutine. This produces output similar to that of the traceback module, for the frames retrieved by get_stack(). The limit argument is passed to get_stack(). The file argument is an I/O stream to which the output is written; by default output is written to sys.stderr. [clinic start generated code]*/ static PyObject * _asyncio_Task_print_stack_impl(TaskObj *self, PyTypeObject *cls, PyObject *limit, PyObject *file) /*[clinic end generated code: output=b38affe9289ec826 input=150b35ba2d3a7dee]*/ { … } /*[clinic input] _asyncio.Task.set_result result: object / [clinic start generated code]*/ static PyObject * _asyncio_Task_set_result(TaskObj *self, PyObject *result) /*[clinic end generated code: output=1dcae308bfcba318 input=9d1a00c07be41bab]*/ { … } /*[clinic input] _asyncio.Task.set_exception exception: object / [clinic start generated code]*/ static PyObject * _asyncio_Task_set_exception(TaskObj *self, PyObject *exception) /*[clinic end generated code: output=bc377fc28067303d input=9a8f65c83dcf893a]*/ { … } /*[clinic input] _asyncio.Task.get_coro [clinic start generated code]*/ static PyObject * _asyncio_Task_get_coro_impl(TaskObj *self) /*[clinic end generated code: output=bcac27c8cc6c8073 input=d2e8606c42a7b403]*/ { … } /*[clinic input] _asyncio.Task.get_context [clinic start generated code]*/ static PyObject * _asyncio_Task_get_context_impl(TaskObj *self) /*[clinic end generated code: output=6996f53d3dc01aef input=87c0b209b8fceeeb]*/ { … } /*[clinic input] _asyncio.Task.get_name [clinic start generated code]*/ static PyObject * _asyncio_Task_get_name_impl(TaskObj *self) /*[clinic end generated code: output=0ecf1570c3b37a8f input=a4a6595d12f4f0f8]*/ { … } /*[clinic input] _asyncio.Task.set_name value: object / [clinic start generated code]*/ static PyObject * _asyncio_Task_set_name(TaskObj *self, PyObject *value) /*[clinic end generated code: output=138a8d51e32057d6 input=a8359b6e65f8fd31]*/ { … } static void TaskObj_finalize(TaskObj *task) { … } static void TaskObj_dealloc(PyObject *); /* Needs Task_CheckExact */ static PyMethodDef TaskType_methods[] = …; static PyGetSetDef TaskType_getsetlist[] = …; static PyType_Slot Task_slots[] = …; static PyType_Spec Task_spec = …; static void TaskObj_dealloc(PyObject *self) { … } static int task_call_step_soon(asyncio_state *state, TaskObj *task, PyObject *arg) { … } static PyObject * task_set_error_soon(asyncio_state *state, TaskObj *task, PyObject *et, const char *format, ...) { … } static inline int gen_status_from_result(PyObject **result) { … } static PyObject * task_step_impl(asyncio_state *state, TaskObj *task, PyObject *exc) { … } static PyObject * task_step_handle_result_impl(asyncio_state *state, TaskObj *task, PyObject *result) { … } static PyObject * task_step(asyncio_state *state, TaskObj *task, PyObject *exc) { … } static int task_eager_start(asyncio_state *state, TaskObj *task) { … } static PyObject * task_wakeup(TaskObj *task, PyObject *o) { … } /*********************** Functions **************************/ /*[clinic input] _asyncio._get_running_loop Return the running event loop or None. This is a low-level function intended to be used by event loops. This function is thread-specific. [clinic start generated code]*/ static PyObject * _asyncio__get_running_loop_impl(PyObject *module) /*[clinic end generated code: output=b4390af721411a0a input=0a21627e25a4bd43]*/ { … } /*[clinic input] _asyncio._set_running_loop loop: 'O' / Set the running event loop. This is a low-level function intended to be used by event loops. This function is thread-specific. [clinic start generated code]*/ static PyObject * _asyncio__set_running_loop(PyObject *module, PyObject *loop) /*[clinic end generated code: output=ae56bf7a28ca189a input=4c9720233d606604]*/ { … } /*[clinic input] _asyncio.get_event_loop Return an asyncio event loop. When called from a coroutine or a callback (e.g. scheduled with call_soon or similar API), this function will always return the running event loop. If there is no running event loop set, the function will return the result of `get_event_loop_policy().get_event_loop()` call. [clinic start generated code]*/ static PyObject * _asyncio_get_event_loop_impl(PyObject *module) /*[clinic end generated code: output=2a2d8b2f824c648b input=9364bf2916c8655d]*/ { … } /*[clinic input] _asyncio.get_running_loop Return the running event loop. Raise a RuntimeError if there is none. This function is thread-specific. [clinic start generated code]*/ static PyObject * _asyncio_get_running_loop_impl(PyObject *module) /*[clinic end generated code: output=c247b5f9e529530e input=2a3bf02ba39f173d]*/ { … } /*[clinic input] _asyncio._register_task task: object Register a new task in asyncio as executed by loop. Returns None. [clinic start generated code]*/ static PyObject * _asyncio__register_task_impl(PyObject *module, PyObject *task) /*[clinic end generated code: output=8672dadd69a7d4e2 input=21075aaea14dfbad]*/ { … } /*[clinic input] _asyncio._register_eager_task task: object Register a new task in asyncio as executed by loop. Returns None. [clinic start generated code]*/ static PyObject * _asyncio__register_eager_task_impl(PyObject *module, PyObject *task) /*[clinic end generated code: output=dfe1d45367c73f1a input=237f684683398c51]*/ { … } /*[clinic input] _asyncio._unregister_task task: object Unregister a task. Returns None. [clinic start generated code]*/ static PyObject * _asyncio__unregister_task_impl(PyObject *module, PyObject *task) /*[clinic end generated code: output=6e5585706d568a46 input=28fb98c3975f7bdc]*/ { … } /*[clinic input] _asyncio._unregister_eager_task task: object Unregister a task. Returns None. [clinic start generated code]*/ static PyObject * _asyncio__unregister_eager_task_impl(PyObject *module, PyObject *task) /*[clinic end generated code: output=a426922bd07f23d1 input=9d07401ef14ee048]*/ { … } /*[clinic input] _asyncio._enter_task loop: object task: object Enter into task execution or resume suspended task. Task belongs to loop. Returns None. [clinic start generated code]*/ static PyObject * _asyncio__enter_task_impl(PyObject *module, PyObject *loop, PyObject *task) /*[clinic end generated code: output=a22611c858035b73 input=de1b06dca70d8737]*/ { … } /*[clinic input] _asyncio._leave_task loop: object task: object Leave task execution or suspend a task. Task belongs to loop. Returns None. [clinic start generated code]*/ static PyObject * _asyncio__leave_task_impl(PyObject *module, PyObject *loop, PyObject *task) /*[clinic end generated code: output=0ebf6db4b858fb41 input=51296a46313d1ad8]*/ { … } /*[clinic input] _asyncio._swap_current_task loop: object task: object Temporarily swap in the supplied task and return the original one (or None). This is intended for use during eager coroutine execution. [clinic start generated code]*/ static PyObject * _asyncio__swap_current_task_impl(PyObject *module, PyObject *loop, PyObject *task) /*[clinic end generated code: output=9f88de958df74c7e input=c9c72208d3d38b6c]*/ { … } /*[clinic input] _asyncio.current_task loop: object = None Return a currently executed task. [clinic start generated code]*/ static PyObject * _asyncio_current_task_impl(PyObject *module, PyObject *loop) /*[clinic end generated code: output=fe15ac331a7f981a input=58910f61a5627112]*/ { … } static inline int add_one_task(asyncio_state *state, PyObject *tasks, PyObject *task, PyObject *loop) { … } /*********************** Module **************************/ /*[clinic input] _asyncio.all_tasks loop: object = None Return a set of all tasks for the loop. [clinic start generated code]*/ static PyObject * _asyncio_all_tasks_impl(PyObject *module, PyObject *loop) /*[clinic end generated code: output=0e107cbb7f72aa7b input=43a1b423c2d95bfa]*/ { … } static int module_traverse(PyObject *mod, visitproc visit, void *arg) { … } static int module_clear(PyObject *mod) { … } static void module_free(void *mod) { … } static int module_init(asyncio_state *state) { … } PyDoc_STRVAR(module_doc, "Accelerator module for asyncio"); static PyMethodDef asyncio_methods[] = …; static int module_exec(PyObject *mod) { … } static struct PyModuleDef_Slot module_slots[] = …; static struct PyModuleDef _asynciomodule = …; PyMODINIT_FUNC PyInit__asyncio(void) { … }