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