1 /*[clinic input] 2 preserve 3 [clinic start generated code]*/ 4 5 PyDoc_STRVAR(_asyncio_Future___init____doc__, 6 "Future(*, loop=None)\n" 7 "--\n" 8 "\n" 9 "This class is *almost* compatible with concurrent.futures.Future.\n" 10 "\n" 11 " Differences:\n" 12 "\n" 13 " - result() and exception() do not take a timeout argument and\n" 14 " raise an exception when the future isn\'t done yet.\n" 15 "\n" 16 " - Callbacks registered with add_done_callback() are always called\n" 17 " via the event loop\'s call_soon_threadsafe().\n" 18 "\n" 19 " - This class is not compatible with the wait() and as_completed()\n" 20 " methods in the concurrent.futures package."); 21 22 static int 23 _asyncio_Future___init___impl(FutureObj *self, PyObject *loop); 24 25 static int 26 _asyncio_Future___init__(PyObject *self, PyObject *args, PyObject *kwargs) 27 { 28 int return_value = -1; 29 static const char * const _keywords[] = {"loop", NULL}; 30 static _PyArg_Parser _parser = {"|$O:Future", _keywords, 0}; 31 PyObject *loop = Py_None; 32 33 if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, 34 &loop)) { 35 goto exit; 36 } 37 return_value = _asyncio_Future___init___impl((FutureObj *)self, loop); 38 39 exit: 40 return return_value; 41 } 42 43 PyDoc_STRVAR(_asyncio_Future_result__doc__, 44 "result($self, /)\n" 45 "--\n" 46 "\n" 47 "Return the result this future represents.\n" 48 "\n" 49 "If the future has been cancelled, raises CancelledError. If the\n" 50 "future\'s result isn\'t yet available, raises InvalidStateError. If\n" 51 "the future is done and has an exception set, this exception is raised."); 52 53 #define _ASYNCIO_FUTURE_RESULT_METHODDEF \ 54 {"result", (PyCFunction)_asyncio_Future_result, METH_NOARGS, _asyncio_Future_result__doc__}, 55 56 static PyObject * 57 _asyncio_Future_result_impl(FutureObj *self); 58 59 static PyObject * 60 _asyncio_Future_result(FutureObj *self, PyObject *Py_UNUSED(ignored)) 61 { 62 return _asyncio_Future_result_impl(self); 63 } 64 65 PyDoc_STRVAR(_asyncio_Future_exception__doc__, 66 "exception($self, /)\n" 67 "--\n" 68 "\n" 69 "Return the exception that was set on this future.\n" 70 "\n" 71 "The exception (or None if no exception was set) is returned only if\n" 72 "the future is done. If the future has been cancelled, raises\n" 73 "CancelledError. If the future isn\'t done yet, raises\n" 74 "InvalidStateError."); 75 76 #define _ASYNCIO_FUTURE_EXCEPTION_METHODDEF \ 77 {"exception", (PyCFunction)_asyncio_Future_exception, METH_NOARGS, _asyncio_Future_exception__doc__}, 78 79 static PyObject * 80 _asyncio_Future_exception_impl(FutureObj *self); 81 82 static PyObject * 83 _asyncio_Future_exception(FutureObj *self, PyObject *Py_UNUSED(ignored)) 84 { 85 return _asyncio_Future_exception_impl(self); 86 } 87 88 PyDoc_STRVAR(_asyncio_Future_set_result__doc__, 89 "set_result($self, result, /)\n" 90 "--\n" 91 "\n" 92 "Mark the future done and set its result.\n" 93 "\n" 94 "If the future is already done when this method is called, raises\n" 95 "InvalidStateError."); 96 97 #define _ASYNCIO_FUTURE_SET_RESULT_METHODDEF \ 98 {"set_result", (PyCFunction)_asyncio_Future_set_result, METH_O, _asyncio_Future_set_result__doc__}, 99 100 PyDoc_STRVAR(_asyncio_Future_set_exception__doc__, 101 "set_exception($self, exception, /)\n" 102 "--\n" 103 "\n" 104 "Mark the future done and set an exception.\n" 105 "\n" 106 "If the future is already done when this method is called, raises\n" 107 "InvalidStateError."); 108 109 #define _ASYNCIO_FUTURE_SET_EXCEPTION_METHODDEF \ 110 {"set_exception", (PyCFunction)_asyncio_Future_set_exception, METH_O, _asyncio_Future_set_exception__doc__}, 111 112 PyDoc_STRVAR(_asyncio_Future_add_done_callback__doc__, 113 "add_done_callback($self, fn, /, *, context=None)\n" 114 "--\n" 115 "\n" 116 "Add a callback to be run when the future becomes done.\n" 117 "\n" 118 "The callback is called with a single argument - the future object. If\n" 119 "the future is already done when this is called, the callback is\n" 120 "scheduled with call_soon."); 121 122 #define _ASYNCIO_FUTURE_ADD_DONE_CALLBACK_METHODDEF \ 123 {"add_done_callback", (PyCFunction)_asyncio_Future_add_done_callback, METH_FASTCALL|METH_KEYWORDS, _asyncio_Future_add_done_callback__doc__}, 124 125 static PyObject * 126 _asyncio_Future_add_done_callback_impl(FutureObj *self, PyObject *fn, 127 PyObject *context); 128 129 static PyObject * 130 _asyncio_Future_add_done_callback(FutureObj *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) 131 { 132 PyObject *return_value = NULL; 133 static const char * const _keywords[] = {"", "context", NULL}; 134 static _PyArg_Parser _parser = {"O|$O:add_done_callback", _keywords, 0}; 135 PyObject *fn; 136 PyObject *context = NULL; 137 138 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, 139 &fn, &context)) { 140 goto exit; 141 } 142 return_value = _asyncio_Future_add_done_callback_impl(self, fn, context); 143 144 exit: 145 return return_value; 146 } 147 148 PyDoc_STRVAR(_asyncio_Future_remove_done_callback__doc__, 149 "remove_done_callback($self, fn, /)\n" 150 "--\n" 151 "\n" 152 "Remove all instances of a callback from the \"call when done\" list.\n" 153 "\n" 154 "Returns the number of callbacks removed."); 155 156 #define _ASYNCIO_FUTURE_REMOVE_DONE_CALLBACK_METHODDEF \ 157 {"remove_done_callback", (PyCFunction)_asyncio_Future_remove_done_callback, METH_O, _asyncio_Future_remove_done_callback__doc__}, 158 159 PyDoc_STRVAR(_asyncio_Future_cancel__doc__, 160 "cancel($self, /)\n" 161 "--\n" 162 "\n" 163 "Cancel the future and schedule callbacks.\n" 164 "\n" 165 "If the future is already done or cancelled, return False. Otherwise,\n" 166 "change the future\'s state to cancelled, schedule the callbacks and\n" 167 "return True."); 168 169 #define _ASYNCIO_FUTURE_CANCEL_METHODDEF \ 170 {"cancel", (PyCFunction)_asyncio_Future_cancel, METH_NOARGS, _asyncio_Future_cancel__doc__}, 171 172 static PyObject * 173 _asyncio_Future_cancel_impl(FutureObj *self); 174 175 static PyObject * 176 _asyncio_Future_cancel(FutureObj *self, PyObject *Py_UNUSED(ignored)) 177 { 178 return _asyncio_Future_cancel_impl(self); 179 } 180 181 PyDoc_STRVAR(_asyncio_Future_cancelled__doc__, 182 "cancelled($self, /)\n" 183 "--\n" 184 "\n" 185 "Return True if the future was cancelled."); 186 187 #define _ASYNCIO_FUTURE_CANCELLED_METHODDEF \ 188 {"cancelled", (PyCFunction)_asyncio_Future_cancelled, METH_NOARGS, _asyncio_Future_cancelled__doc__}, 189 190 static PyObject * 191 _asyncio_Future_cancelled_impl(FutureObj *self); 192 193 static PyObject * 194 _asyncio_Future_cancelled(FutureObj *self, PyObject *Py_UNUSED(ignored)) 195 { 196 return _asyncio_Future_cancelled_impl(self); 197 } 198 199 PyDoc_STRVAR(_asyncio_Future_done__doc__, 200 "done($self, /)\n" 201 "--\n" 202 "\n" 203 "Return True if the future is done.\n" 204 "\n" 205 "Done means either that a result / exception are available, or that the\n" 206 "future was cancelled."); 207 208 #define _ASYNCIO_FUTURE_DONE_METHODDEF \ 209 {"done", (PyCFunction)_asyncio_Future_done, METH_NOARGS, _asyncio_Future_done__doc__}, 210 211 static PyObject * 212 _asyncio_Future_done_impl(FutureObj *self); 213 214 static PyObject * 215 _asyncio_Future_done(FutureObj *self, PyObject *Py_UNUSED(ignored)) 216 { 217 return _asyncio_Future_done_impl(self); 218 } 219 220 PyDoc_STRVAR(_asyncio_Future_get_loop__doc__, 221 "get_loop($self, /)\n" 222 "--\n" 223 "\n" 224 "Return the event loop the Future is bound to."); 225 226 #define _ASYNCIO_FUTURE_GET_LOOP_METHODDEF \ 227 {"get_loop", (PyCFunction)_asyncio_Future_get_loop, METH_NOARGS, _asyncio_Future_get_loop__doc__}, 228 229 static PyObject * 230 _asyncio_Future_get_loop_impl(FutureObj *self); 231 232 static PyObject * 233 _asyncio_Future_get_loop(FutureObj *self, PyObject *Py_UNUSED(ignored)) 234 { 235 return _asyncio_Future_get_loop_impl(self); 236 } 237 238 PyDoc_STRVAR(_asyncio_Future__repr_info__doc__, 239 "_repr_info($self, /)\n" 240 "--\n" 241 "\n"); 242 243 #define _ASYNCIO_FUTURE__REPR_INFO_METHODDEF \ 244 {"_repr_info", (PyCFunction)_asyncio_Future__repr_info, METH_NOARGS, _asyncio_Future__repr_info__doc__}, 245 246 static PyObject * 247 _asyncio_Future__repr_info_impl(FutureObj *self); 248 249 static PyObject * 250 _asyncio_Future__repr_info(FutureObj *self, PyObject *Py_UNUSED(ignored)) 251 { 252 return _asyncio_Future__repr_info_impl(self); 253 } 254 255 PyDoc_STRVAR(_asyncio_Task___init____doc__, 256 "Task(coro, *, loop=None)\n" 257 "--\n" 258 "\n" 259 "A coroutine wrapped in a Future."); 260 261 static int 262 _asyncio_Task___init___impl(TaskObj *self, PyObject *coro, PyObject *loop); 263 264 static int 265 _asyncio_Task___init__(PyObject *self, PyObject *args, PyObject *kwargs) 266 { 267 int return_value = -1; 268 static const char * const _keywords[] = {"coro", "loop", NULL}; 269 static _PyArg_Parser _parser = {"O|$O:Task", _keywords, 0}; 270 PyObject *coro; 271 PyObject *loop = Py_None; 272 273 if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, 274 &coro, &loop)) { 275 goto exit; 276 } 277 return_value = _asyncio_Task___init___impl((TaskObj *)self, coro, loop); 278 279 exit: 280 return return_value; 281 } 282 283 PyDoc_STRVAR(_asyncio_Task_current_task__doc__, 284 "current_task($type, /, loop=None)\n" 285 "--\n" 286 "\n" 287 "Return the currently running task in an event loop or None.\n" 288 "\n" 289 "By default the current task for the current event loop is returned.\n" 290 "\n" 291 "None is returned when called not in the context of a Task."); 292 293 #define _ASYNCIO_TASK_CURRENT_TASK_METHODDEF \ 294 {"current_task", (PyCFunction)_asyncio_Task_current_task, METH_FASTCALL|METH_KEYWORDS|METH_CLASS, _asyncio_Task_current_task__doc__}, 295 296 static PyObject * 297 _asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop); 298 299 static PyObject * 300 _asyncio_Task_current_task(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) 301 { 302 PyObject *return_value = NULL; 303 static const char * const _keywords[] = {"loop", NULL}; 304 static _PyArg_Parser _parser = {"|O:current_task", _keywords, 0}; 305 PyObject *loop = Py_None; 306 307 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, 308 &loop)) { 309 goto exit; 310 } 311 return_value = _asyncio_Task_current_task_impl(type, loop); 312 313 exit: 314 return return_value; 315 } 316 317 PyDoc_STRVAR(_asyncio_Task_all_tasks__doc__, 318 "all_tasks($type, /, loop=None)\n" 319 "--\n" 320 "\n" 321 "Return a set of all tasks for an event loop.\n" 322 "\n" 323 "By default all tasks for the current event loop are returned."); 324 325 #define _ASYNCIO_TASK_ALL_TASKS_METHODDEF \ 326 {"all_tasks", (PyCFunction)_asyncio_Task_all_tasks, METH_FASTCALL|METH_KEYWORDS|METH_CLASS, _asyncio_Task_all_tasks__doc__}, 327 328 static PyObject * 329 _asyncio_Task_all_tasks_impl(PyTypeObject *type, PyObject *loop); 330 331 static PyObject * 332 _asyncio_Task_all_tasks(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) 333 { 334 PyObject *return_value = NULL; 335 static const char * const _keywords[] = {"loop", NULL}; 336 static _PyArg_Parser _parser = {"|O:all_tasks", _keywords, 0}; 337 PyObject *loop = Py_None; 338 339 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, 340 &loop)) { 341 goto exit; 342 } 343 return_value = _asyncio_Task_all_tasks_impl(type, loop); 344 345 exit: 346 return return_value; 347 } 348 349 PyDoc_STRVAR(_asyncio_Task__repr_info__doc__, 350 "_repr_info($self, /)\n" 351 "--\n" 352 "\n"); 353 354 #define _ASYNCIO_TASK__REPR_INFO_METHODDEF \ 355 {"_repr_info", (PyCFunction)_asyncio_Task__repr_info, METH_NOARGS, _asyncio_Task__repr_info__doc__}, 356 357 static PyObject * 358 _asyncio_Task__repr_info_impl(TaskObj *self); 359 360 static PyObject * 361 _asyncio_Task__repr_info(TaskObj *self, PyObject *Py_UNUSED(ignored)) 362 { 363 return _asyncio_Task__repr_info_impl(self); 364 } 365 366 PyDoc_STRVAR(_asyncio_Task_cancel__doc__, 367 "cancel($self, /)\n" 368 "--\n" 369 "\n" 370 "Request that this task cancel itself.\n" 371 "\n" 372 "This arranges for a CancelledError to be thrown into the\n" 373 "wrapped coroutine on the next cycle through the event loop.\n" 374 "The coroutine then has a chance to clean up or even deny\n" 375 "the request using try/except/finally.\n" 376 "\n" 377 "Unlike Future.cancel, this does not guarantee that the\n" 378 "task will be cancelled: the exception might be caught and\n" 379 "acted upon, delaying cancellation of the task or preventing\n" 380 "cancellation completely. The task may also return a value or\n" 381 "raise a different exception.\n" 382 "\n" 383 "Immediately after this method is called, Task.cancelled() will\n" 384 "not return True (unless the task was already cancelled). A\n" 385 "task will be marked as cancelled when the wrapped coroutine\n" 386 "terminates with a CancelledError exception (even if cancel()\n" 387 "was not called)."); 388 389 #define _ASYNCIO_TASK_CANCEL_METHODDEF \ 390 {"cancel", (PyCFunction)_asyncio_Task_cancel, METH_NOARGS, _asyncio_Task_cancel__doc__}, 391 392 static PyObject * 393 _asyncio_Task_cancel_impl(TaskObj *self); 394 395 static PyObject * 396 _asyncio_Task_cancel(TaskObj *self, PyObject *Py_UNUSED(ignored)) 397 { 398 return _asyncio_Task_cancel_impl(self); 399 } 400 401 PyDoc_STRVAR(_asyncio_Task_get_stack__doc__, 402 "get_stack($self, /, *, limit=None)\n" 403 "--\n" 404 "\n" 405 "Return the list of stack frames for this task\'s coroutine.\n" 406 "\n" 407 "If the coroutine is not done, this returns the stack where it is\n" 408 "suspended. If the coroutine has completed successfully or was\n" 409 "cancelled, this returns an empty list. If the coroutine was\n" 410 "terminated by an exception, this returns the list of traceback\n" 411 "frames.\n" 412 "\n" 413 "The frames are always ordered from oldest to newest.\n" 414 "\n" 415 "The optional limit gives the maximum number of frames to\n" 416 "return; by default all available frames are returned. Its\n" 417 "meaning differs depending on whether a stack or a traceback is\n" 418 "returned: the newest frames of a stack are returned, but the\n" 419 "oldest frames of a traceback are returned. (This matches the\n" 420 "behavior of the traceback module.)\n" 421 "\n" 422 "For reasons beyond our control, only one stack frame is\n" 423 "returned for a suspended coroutine."); 424 425 #define _ASYNCIO_TASK_GET_STACK_METHODDEF \ 426 {"get_stack", (PyCFunction)_asyncio_Task_get_stack, METH_FASTCALL|METH_KEYWORDS, _asyncio_Task_get_stack__doc__}, 427 428 static PyObject * 429 _asyncio_Task_get_stack_impl(TaskObj *self, PyObject *limit); 430 431 static PyObject * 432 _asyncio_Task_get_stack(TaskObj *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) 433 { 434 PyObject *return_value = NULL; 435 static const char * const _keywords[] = {"limit", NULL}; 436 static _PyArg_Parser _parser = {"|$O:get_stack", _keywords, 0}; 437 PyObject *limit = Py_None; 438 439 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, 440 &limit)) { 441 goto exit; 442 } 443 return_value = _asyncio_Task_get_stack_impl(self, limit); 444 445 exit: 446 return return_value; 447 } 448 449 PyDoc_STRVAR(_asyncio_Task_print_stack__doc__, 450 "print_stack($self, /, *, limit=None, file=None)\n" 451 "--\n" 452 "\n" 453 "Print the stack or traceback for this task\'s coroutine.\n" 454 "\n" 455 "This produces output similar to that of the traceback module,\n" 456 "for the frames retrieved by get_stack(). The limit argument\n" 457 "is passed to get_stack(). The file argument is an I/O stream\n" 458 "to which the output is written; by default output is written\n" 459 "to sys.stderr."); 460 461 #define _ASYNCIO_TASK_PRINT_STACK_METHODDEF \ 462 {"print_stack", (PyCFunction)_asyncio_Task_print_stack, METH_FASTCALL|METH_KEYWORDS, _asyncio_Task_print_stack__doc__}, 463 464 static PyObject * 465 _asyncio_Task_print_stack_impl(TaskObj *self, PyObject *limit, 466 PyObject *file); 467 468 static PyObject * 469 _asyncio_Task_print_stack(TaskObj *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) 470 { 471 PyObject *return_value = NULL; 472 static const char * const _keywords[] = {"limit", "file", NULL}; 473 static _PyArg_Parser _parser = {"|$OO:print_stack", _keywords, 0}; 474 PyObject *limit = Py_None; 475 PyObject *file = Py_None; 476 477 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, 478 &limit, &file)) { 479 goto exit; 480 } 481 return_value = _asyncio_Task_print_stack_impl(self, limit, file); 482 483 exit: 484 return return_value; 485 } 486 487 PyDoc_STRVAR(_asyncio_Task_set_result__doc__, 488 "set_result($self, result, /)\n" 489 "--\n" 490 "\n"); 491 492 #define _ASYNCIO_TASK_SET_RESULT_METHODDEF \ 493 {"set_result", (PyCFunction)_asyncio_Task_set_result, METH_O, _asyncio_Task_set_result__doc__}, 494 495 PyDoc_STRVAR(_asyncio_Task_set_exception__doc__, 496 "set_exception($self, exception, /)\n" 497 "--\n" 498 "\n"); 499 500 #define _ASYNCIO_TASK_SET_EXCEPTION_METHODDEF \ 501 {"set_exception", (PyCFunction)_asyncio_Task_set_exception, METH_O, _asyncio_Task_set_exception__doc__}, 502 503 PyDoc_STRVAR(_asyncio__get_running_loop__doc__, 504 "_get_running_loop($module, /)\n" 505 "--\n" 506 "\n" 507 "Return the running event loop or None.\n" 508 "\n" 509 "This is a low-level function intended to be used by event loops.\n" 510 "This function is thread-specific."); 511 512 #define _ASYNCIO__GET_RUNNING_LOOP_METHODDEF \ 513 {"_get_running_loop", (PyCFunction)_asyncio__get_running_loop, METH_NOARGS, _asyncio__get_running_loop__doc__}, 514 515 static PyObject * 516 _asyncio__get_running_loop_impl(PyObject *module); 517 518 static PyObject * 519 _asyncio__get_running_loop(PyObject *module, PyObject *Py_UNUSED(ignored)) 520 { 521 return _asyncio__get_running_loop_impl(module); 522 } 523 524 PyDoc_STRVAR(_asyncio__set_running_loop__doc__, 525 "_set_running_loop($module, loop, /)\n" 526 "--\n" 527 "\n" 528 "Set the running event loop.\n" 529 "\n" 530 "This is a low-level function intended to be used by event loops.\n" 531 "This function is thread-specific."); 532 533 #define _ASYNCIO__SET_RUNNING_LOOP_METHODDEF \ 534 {"_set_running_loop", (PyCFunction)_asyncio__set_running_loop, METH_O, _asyncio__set_running_loop__doc__}, 535 536 PyDoc_STRVAR(_asyncio_get_event_loop__doc__, 537 "get_event_loop($module, /)\n" 538 "--\n" 539 "\n" 540 "Return an asyncio event loop.\n" 541 "\n" 542 "When called from a coroutine or a callback (e.g. scheduled with\n" 543 "call_soon or similar API), this function will always return the\n" 544 "running event loop.\n" 545 "\n" 546 "If there is no running event loop set, the function will return\n" 547 "the result of `get_event_loop_policy().get_event_loop()` call."); 548 549 #define _ASYNCIO_GET_EVENT_LOOP_METHODDEF \ 550 {"get_event_loop", (PyCFunction)_asyncio_get_event_loop, METH_NOARGS, _asyncio_get_event_loop__doc__}, 551 552 static PyObject * 553 _asyncio_get_event_loop_impl(PyObject *module); 554 555 static PyObject * 556 _asyncio_get_event_loop(PyObject *module, PyObject *Py_UNUSED(ignored)) 557 { 558 return _asyncio_get_event_loop_impl(module); 559 } 560 561 PyDoc_STRVAR(_asyncio_get_running_loop__doc__, 562 "get_running_loop($module, /)\n" 563 "--\n" 564 "\n" 565 "Return the running event loop. Raise a RuntimeError if there is none.\n" 566 "\n" 567 "This function is thread-specific."); 568 569 #define _ASYNCIO_GET_RUNNING_LOOP_METHODDEF \ 570 {"get_running_loop", (PyCFunction)_asyncio_get_running_loop, METH_NOARGS, _asyncio_get_running_loop__doc__}, 571 572 static PyObject * 573 _asyncio_get_running_loop_impl(PyObject *module); 574 575 static PyObject * 576 _asyncio_get_running_loop(PyObject *module, PyObject *Py_UNUSED(ignored)) 577 { 578 return _asyncio_get_running_loop_impl(module); 579 } 580 581 PyDoc_STRVAR(_asyncio__register_task__doc__, 582 "_register_task($module, /, task)\n" 583 "--\n" 584 "\n" 585 "Register a new task in asyncio as executed by loop.\n" 586 "\n" 587 "Returns None."); 588 589 #define _ASYNCIO__REGISTER_TASK_METHODDEF \ 590 {"_register_task", (PyCFunction)_asyncio__register_task, METH_FASTCALL|METH_KEYWORDS, _asyncio__register_task__doc__}, 591 592 static PyObject * 593 _asyncio__register_task_impl(PyObject *module, PyObject *task); 594 595 static PyObject * 596 _asyncio__register_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) 597 { 598 PyObject *return_value = NULL; 599 static const char * const _keywords[] = {"task", NULL}; 600 static _PyArg_Parser _parser = {"O:_register_task", _keywords, 0}; 601 PyObject *task; 602 603 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, 604 &task)) { 605 goto exit; 606 } 607 return_value = _asyncio__register_task_impl(module, task); 608 609 exit: 610 return return_value; 611 } 612 613 PyDoc_STRVAR(_asyncio__unregister_task__doc__, 614 "_unregister_task($module, /, task)\n" 615 "--\n" 616 "\n" 617 "Unregister a task.\n" 618 "\n" 619 "Returns None."); 620 621 #define _ASYNCIO__UNREGISTER_TASK_METHODDEF \ 622 {"_unregister_task", (PyCFunction)_asyncio__unregister_task, METH_FASTCALL|METH_KEYWORDS, _asyncio__unregister_task__doc__}, 623 624 static PyObject * 625 _asyncio__unregister_task_impl(PyObject *module, PyObject *task); 626 627 static PyObject * 628 _asyncio__unregister_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) 629 { 630 PyObject *return_value = NULL; 631 static const char * const _keywords[] = {"task", NULL}; 632 static _PyArg_Parser _parser = {"O:_unregister_task", _keywords, 0}; 633 PyObject *task; 634 635 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, 636 &task)) { 637 goto exit; 638 } 639 return_value = _asyncio__unregister_task_impl(module, task); 640 641 exit: 642 return return_value; 643 } 644 645 PyDoc_STRVAR(_asyncio__enter_task__doc__, 646 "_enter_task($module, /, loop, task)\n" 647 "--\n" 648 "\n" 649 "Enter into task execution or resume suspended task.\n" 650 "\n" 651 "Task belongs to loop.\n" 652 "\n" 653 "Returns None."); 654 655 #define _ASYNCIO__ENTER_TASK_METHODDEF \ 656 {"_enter_task", (PyCFunction)_asyncio__enter_task, METH_FASTCALL|METH_KEYWORDS, _asyncio__enter_task__doc__}, 657 658 static PyObject * 659 _asyncio__enter_task_impl(PyObject *module, PyObject *loop, PyObject *task); 660 661 static PyObject * 662 _asyncio__enter_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) 663 { 664 PyObject *return_value = NULL; 665 static const char * const _keywords[] = {"loop", "task", NULL}; 666 static _PyArg_Parser _parser = {"OO:_enter_task", _keywords, 0}; 667 PyObject *loop; 668 PyObject *task; 669 670 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, 671 &loop, &task)) { 672 goto exit; 673 } 674 return_value = _asyncio__enter_task_impl(module, loop, task); 675 676 exit: 677 return return_value; 678 } 679 680 PyDoc_STRVAR(_asyncio__leave_task__doc__, 681 "_leave_task($module, /, loop, task)\n" 682 "--\n" 683 "\n" 684 "Leave task execution or suspend a task.\n" 685 "\n" 686 "Task belongs to loop.\n" 687 "\n" 688 "Returns None."); 689 690 #define _ASYNCIO__LEAVE_TASK_METHODDEF \ 691 {"_leave_task", (PyCFunction)_asyncio__leave_task, METH_FASTCALL|METH_KEYWORDS, _asyncio__leave_task__doc__}, 692 693 static PyObject * 694 _asyncio__leave_task_impl(PyObject *module, PyObject *loop, PyObject *task); 695 696 static PyObject * 697 _asyncio__leave_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) 698 { 699 PyObject *return_value = NULL; 700 static const char * const _keywords[] = {"loop", "task", NULL}; 701 static _PyArg_Parser _parser = {"OO:_leave_task", _keywords, 0}; 702 PyObject *loop; 703 PyObject *task; 704 705 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, 706 &loop, &task)) { 707 goto exit; 708 } 709 return_value = _asyncio__leave_task_impl(module, loop, task); 710 711 exit: 712 return return_value; 713 } 714 /*[clinic end generated code: output=b6148b0134e7a819 input=a9049054013a1b77]*/ 715