/src/cpython/Modules/clinic/_asynciomodule.c.h
Line | Count | Source (jump to first uncovered line) |
1 | | /*[clinic input] |
2 | | preserve |
3 | | [clinic start generated code]*/ |
4 | | |
5 | | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
6 | | # include "pycore_gc.h" // PyGC_Head |
7 | | # include "pycore_runtime.h" // _Py_ID() |
8 | | #endif |
9 | | #include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION() |
10 | | #include "pycore_modsupport.h" // _PyArg_UnpackKeywords() |
11 | | |
12 | | PyDoc_STRVAR(_asyncio_Future___init____doc__, |
13 | | "Future(*, loop=None)\n" |
14 | | "--\n" |
15 | | "\n" |
16 | | "This class is *almost* compatible with concurrent.futures.Future.\n" |
17 | | "\n" |
18 | | " Differences:\n" |
19 | | "\n" |
20 | | " - result() and exception() do not take a timeout argument and\n" |
21 | | " raise an exception when the future isn\'t done yet.\n" |
22 | | "\n" |
23 | | " - Callbacks registered with add_done_callback() are always called\n" |
24 | | " via the event loop\'s call_soon_threadsafe().\n" |
25 | | "\n" |
26 | | " - This class is not compatible with the wait() and as_completed()\n" |
27 | | " methods in the concurrent.futures package."); |
28 | | |
29 | | static int |
30 | | _asyncio_Future___init___impl(FutureObj *self, PyObject *loop); |
31 | | |
32 | | static int |
33 | | _asyncio_Future___init__(PyObject *self, PyObject *args, PyObject *kwargs) |
34 | 0 | { |
35 | 0 | int return_value = -1; |
36 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
37 | |
|
38 | 0 | #define NUM_KEYWORDS 1 |
39 | 0 | static struct { |
40 | 0 | PyGC_Head _this_is_not_used; |
41 | 0 | PyObject_VAR_HEAD |
42 | 0 | Py_hash_t ob_hash; |
43 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
44 | 0 | } _kwtuple = { |
45 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
46 | 0 | .ob_hash = -1, |
47 | 0 | .ob_item = { &_Py_ID(loop), }, |
48 | 0 | }; |
49 | 0 | #undef NUM_KEYWORDS |
50 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
51 | |
|
52 | | #else // !Py_BUILD_CORE |
53 | | # define KWTUPLE NULL |
54 | | #endif // !Py_BUILD_CORE |
55 | |
|
56 | 0 | static const char * const _keywords[] = {"loop", NULL}; |
57 | 0 | static _PyArg_Parser _parser = { |
58 | 0 | .keywords = _keywords, |
59 | 0 | .fname = "Future", |
60 | 0 | .kwtuple = KWTUPLE, |
61 | 0 | }; |
62 | 0 | #undef KWTUPLE |
63 | 0 | PyObject *argsbuf[1]; |
64 | 0 | PyObject * const *fastargs; |
65 | 0 | Py_ssize_t nargs = PyTuple_GET_SIZE(args); |
66 | 0 | Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0; |
67 | 0 | PyObject *loop = Py_None; |
68 | |
|
69 | 0 | fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, |
70 | 0 | /*minpos*/ 0, /*maxpos*/ 0, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
71 | 0 | if (!fastargs) { |
72 | 0 | goto exit; |
73 | 0 | } |
74 | 0 | if (!noptargs) { |
75 | 0 | goto skip_optional_kwonly; |
76 | 0 | } |
77 | 0 | loop = fastargs[0]; |
78 | 0 | skip_optional_kwonly: |
79 | 0 | return_value = _asyncio_Future___init___impl((FutureObj *)self, loop); |
80 | |
|
81 | 0 | exit: |
82 | 0 | return return_value; |
83 | 0 | } |
84 | | |
85 | | PyDoc_STRVAR(_asyncio_Future_result__doc__, |
86 | | "result($self, /)\n" |
87 | | "--\n" |
88 | | "\n" |
89 | | "Return the result this future represents.\n" |
90 | | "\n" |
91 | | "If the future has been cancelled, raises CancelledError. If the\n" |
92 | | "future\'s result isn\'t yet available, raises InvalidStateError. If\n" |
93 | | "the future is done and has an exception set, this exception is raised."); |
94 | | |
95 | | #define _ASYNCIO_FUTURE_RESULT_METHODDEF \ |
96 | | {"result", (PyCFunction)_asyncio_Future_result, METH_NOARGS, _asyncio_Future_result__doc__}, |
97 | | |
98 | | static PyObject * |
99 | | _asyncio_Future_result_impl(FutureObj *self); |
100 | | |
101 | | static PyObject * |
102 | | _asyncio_Future_result(PyObject *self, PyObject *Py_UNUSED(ignored)) |
103 | 0 | { |
104 | 0 | PyObject *return_value = NULL; |
105 | |
|
106 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
107 | 0 | return_value = _asyncio_Future_result_impl((FutureObj *)self); |
108 | 0 | Py_END_CRITICAL_SECTION(); |
109 | |
|
110 | 0 | return return_value; |
111 | 0 | } |
112 | | |
113 | | PyDoc_STRVAR(_asyncio_Future_exception__doc__, |
114 | | "exception($self, /)\n" |
115 | | "--\n" |
116 | | "\n" |
117 | | "Return the exception that was set on this future.\n" |
118 | | "\n" |
119 | | "The exception (or None if no exception was set) is returned only if\n" |
120 | | "the future is done. If the future has been cancelled, raises\n" |
121 | | "CancelledError. If the future isn\'t done yet, raises\n" |
122 | | "InvalidStateError."); |
123 | | |
124 | | #define _ASYNCIO_FUTURE_EXCEPTION_METHODDEF \ |
125 | | {"exception", _PyCFunction_CAST(_asyncio_Future_exception), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _asyncio_Future_exception__doc__}, |
126 | | |
127 | | static PyObject * |
128 | | _asyncio_Future_exception_impl(FutureObj *self, PyTypeObject *cls); |
129 | | |
130 | | static PyObject * |
131 | | _asyncio_Future_exception(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
132 | 0 | { |
133 | 0 | PyObject *return_value = NULL; |
134 | |
|
135 | 0 | if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) { |
136 | 0 | PyErr_SetString(PyExc_TypeError, "exception() takes no arguments"); |
137 | 0 | goto exit; |
138 | 0 | } |
139 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
140 | 0 | return_value = _asyncio_Future_exception_impl((FutureObj *)self, cls); |
141 | 0 | Py_END_CRITICAL_SECTION(); |
142 | |
|
143 | 0 | exit: |
144 | 0 | return return_value; |
145 | 0 | } |
146 | | |
147 | | PyDoc_STRVAR(_asyncio_Future_set_result__doc__, |
148 | | "set_result($self, result, /)\n" |
149 | | "--\n" |
150 | | "\n" |
151 | | "Mark the future done and set its result.\n" |
152 | | "\n" |
153 | | "If the future is already done when this method is called, raises\n" |
154 | | "InvalidStateError."); |
155 | | |
156 | | #define _ASYNCIO_FUTURE_SET_RESULT_METHODDEF \ |
157 | | {"set_result", _PyCFunction_CAST(_asyncio_Future_set_result), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _asyncio_Future_set_result__doc__}, |
158 | | |
159 | | static PyObject * |
160 | | _asyncio_Future_set_result_impl(FutureObj *self, PyTypeObject *cls, |
161 | | PyObject *result); |
162 | | |
163 | | static PyObject * |
164 | | _asyncio_Future_set_result(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
165 | 0 | { |
166 | 0 | PyObject *return_value = NULL; |
167 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
168 | 0 | # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
169 | | #else |
170 | | # define KWTUPLE NULL |
171 | | #endif |
172 | |
|
173 | 0 | static const char * const _keywords[] = {"", NULL}; |
174 | 0 | static _PyArg_Parser _parser = { |
175 | 0 | .keywords = _keywords, |
176 | 0 | .fname = "set_result", |
177 | 0 | .kwtuple = KWTUPLE, |
178 | 0 | }; |
179 | 0 | #undef KWTUPLE |
180 | 0 | PyObject *argsbuf[1]; |
181 | 0 | PyObject *result; |
182 | |
|
183 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
184 | 0 | /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
185 | 0 | if (!args) { |
186 | 0 | goto exit; |
187 | 0 | } |
188 | 0 | result = args[0]; |
189 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
190 | 0 | return_value = _asyncio_Future_set_result_impl((FutureObj *)self, cls, result); |
191 | 0 | Py_END_CRITICAL_SECTION(); |
192 | |
|
193 | 0 | exit: |
194 | 0 | return return_value; |
195 | 0 | } |
196 | | |
197 | | PyDoc_STRVAR(_asyncio_Future_set_exception__doc__, |
198 | | "set_exception($self, exception, /)\n" |
199 | | "--\n" |
200 | | "\n" |
201 | | "Mark the future done and set an exception.\n" |
202 | | "\n" |
203 | | "If the future is already done when this method is called, raises\n" |
204 | | "InvalidStateError."); |
205 | | |
206 | | #define _ASYNCIO_FUTURE_SET_EXCEPTION_METHODDEF \ |
207 | | {"set_exception", _PyCFunction_CAST(_asyncio_Future_set_exception), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _asyncio_Future_set_exception__doc__}, |
208 | | |
209 | | static PyObject * |
210 | | _asyncio_Future_set_exception_impl(FutureObj *self, PyTypeObject *cls, |
211 | | PyObject *exception); |
212 | | |
213 | | static PyObject * |
214 | | _asyncio_Future_set_exception(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
215 | 0 | { |
216 | 0 | PyObject *return_value = NULL; |
217 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
218 | 0 | # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
219 | | #else |
220 | | # define KWTUPLE NULL |
221 | | #endif |
222 | |
|
223 | 0 | static const char * const _keywords[] = {"", NULL}; |
224 | 0 | static _PyArg_Parser _parser = { |
225 | 0 | .keywords = _keywords, |
226 | 0 | .fname = "set_exception", |
227 | 0 | .kwtuple = KWTUPLE, |
228 | 0 | }; |
229 | 0 | #undef KWTUPLE |
230 | 0 | PyObject *argsbuf[1]; |
231 | 0 | PyObject *exception; |
232 | |
|
233 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
234 | 0 | /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
235 | 0 | if (!args) { |
236 | 0 | goto exit; |
237 | 0 | } |
238 | 0 | exception = args[0]; |
239 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
240 | 0 | return_value = _asyncio_Future_set_exception_impl((FutureObj *)self, cls, exception); |
241 | 0 | Py_END_CRITICAL_SECTION(); |
242 | |
|
243 | 0 | exit: |
244 | 0 | return return_value; |
245 | 0 | } |
246 | | |
247 | | PyDoc_STRVAR(_asyncio_Future_add_done_callback__doc__, |
248 | | "add_done_callback($self, fn, /, *, context=<unrepresentable>)\n" |
249 | | "--\n" |
250 | | "\n" |
251 | | "Add a callback to be run when the future becomes done.\n" |
252 | | "\n" |
253 | | "The callback is called with a single argument - the future object. If\n" |
254 | | "the future is already done when this is called, the callback is\n" |
255 | | "scheduled with call_soon."); |
256 | | |
257 | | #define _ASYNCIO_FUTURE_ADD_DONE_CALLBACK_METHODDEF \ |
258 | | {"add_done_callback", _PyCFunction_CAST(_asyncio_Future_add_done_callback), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _asyncio_Future_add_done_callback__doc__}, |
259 | | |
260 | | static PyObject * |
261 | | _asyncio_Future_add_done_callback_impl(FutureObj *self, PyTypeObject *cls, |
262 | | PyObject *fn, PyObject *context); |
263 | | |
264 | | static PyObject * |
265 | | _asyncio_Future_add_done_callback(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
266 | 0 | { |
267 | 0 | PyObject *return_value = NULL; |
268 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
269 | |
|
270 | 0 | #define NUM_KEYWORDS 1 |
271 | 0 | static struct { |
272 | 0 | PyGC_Head _this_is_not_used; |
273 | 0 | PyObject_VAR_HEAD |
274 | 0 | Py_hash_t ob_hash; |
275 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
276 | 0 | } _kwtuple = { |
277 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
278 | 0 | .ob_hash = -1, |
279 | 0 | .ob_item = { &_Py_ID(context), }, |
280 | 0 | }; |
281 | 0 | #undef NUM_KEYWORDS |
282 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
283 | |
|
284 | | #else // !Py_BUILD_CORE |
285 | | # define KWTUPLE NULL |
286 | | #endif // !Py_BUILD_CORE |
287 | |
|
288 | 0 | static const char * const _keywords[] = {"", "context", NULL}; |
289 | 0 | static _PyArg_Parser _parser = { |
290 | 0 | .keywords = _keywords, |
291 | 0 | .fname = "add_done_callback", |
292 | 0 | .kwtuple = KWTUPLE, |
293 | 0 | }; |
294 | 0 | #undef KWTUPLE |
295 | 0 | PyObject *argsbuf[2]; |
296 | 0 | Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; |
297 | 0 | PyObject *fn; |
298 | 0 | PyObject *context = NULL; |
299 | |
|
300 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
301 | 0 | /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
302 | 0 | if (!args) { |
303 | 0 | goto exit; |
304 | 0 | } |
305 | 0 | fn = args[0]; |
306 | 0 | if (!noptargs) { |
307 | 0 | goto skip_optional_kwonly; |
308 | 0 | } |
309 | 0 | context = args[1]; |
310 | 0 | skip_optional_kwonly: |
311 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
312 | 0 | return_value = _asyncio_Future_add_done_callback_impl((FutureObj *)self, cls, fn, context); |
313 | 0 | Py_END_CRITICAL_SECTION(); |
314 | |
|
315 | 0 | exit: |
316 | 0 | return return_value; |
317 | 0 | } |
318 | | |
319 | | PyDoc_STRVAR(_asyncio_Future_remove_done_callback__doc__, |
320 | | "remove_done_callback($self, fn, /)\n" |
321 | | "--\n" |
322 | | "\n" |
323 | | "Remove all instances of a callback from the \"call when done\" list.\n" |
324 | | "\n" |
325 | | "Returns the number of callbacks removed."); |
326 | | |
327 | | #define _ASYNCIO_FUTURE_REMOVE_DONE_CALLBACK_METHODDEF \ |
328 | | {"remove_done_callback", _PyCFunction_CAST(_asyncio_Future_remove_done_callback), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _asyncio_Future_remove_done_callback__doc__}, |
329 | | |
330 | | static PyObject * |
331 | | _asyncio_Future_remove_done_callback_impl(FutureObj *self, PyTypeObject *cls, |
332 | | PyObject *fn); |
333 | | |
334 | | static PyObject * |
335 | | _asyncio_Future_remove_done_callback(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
336 | 0 | { |
337 | 0 | PyObject *return_value = NULL; |
338 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
339 | 0 | # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
340 | | #else |
341 | | # define KWTUPLE NULL |
342 | | #endif |
343 | |
|
344 | 0 | static const char * const _keywords[] = {"", NULL}; |
345 | 0 | static _PyArg_Parser _parser = { |
346 | 0 | .keywords = _keywords, |
347 | 0 | .fname = "remove_done_callback", |
348 | 0 | .kwtuple = KWTUPLE, |
349 | 0 | }; |
350 | 0 | #undef KWTUPLE |
351 | 0 | PyObject *argsbuf[1]; |
352 | 0 | PyObject *fn; |
353 | |
|
354 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
355 | 0 | /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
356 | 0 | if (!args) { |
357 | 0 | goto exit; |
358 | 0 | } |
359 | 0 | fn = args[0]; |
360 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
361 | 0 | return_value = _asyncio_Future_remove_done_callback_impl((FutureObj *)self, cls, fn); |
362 | 0 | Py_END_CRITICAL_SECTION(); |
363 | |
|
364 | 0 | exit: |
365 | 0 | return return_value; |
366 | 0 | } |
367 | | |
368 | | PyDoc_STRVAR(_asyncio_Future_cancel__doc__, |
369 | | "cancel($self, /, msg=None)\n" |
370 | | "--\n" |
371 | | "\n" |
372 | | "Cancel the future and schedule callbacks.\n" |
373 | | "\n" |
374 | | "If the future is already done or cancelled, return False. Otherwise,\n" |
375 | | "change the future\'s state to cancelled, schedule the callbacks and\n" |
376 | | "return True."); |
377 | | |
378 | | #define _ASYNCIO_FUTURE_CANCEL_METHODDEF \ |
379 | | {"cancel", _PyCFunction_CAST(_asyncio_Future_cancel), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _asyncio_Future_cancel__doc__}, |
380 | | |
381 | | static PyObject * |
382 | | _asyncio_Future_cancel_impl(FutureObj *self, PyTypeObject *cls, |
383 | | PyObject *msg); |
384 | | |
385 | | static PyObject * |
386 | | _asyncio_Future_cancel(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
387 | 0 | { |
388 | 0 | PyObject *return_value = NULL; |
389 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
390 | |
|
391 | 0 | #define NUM_KEYWORDS 1 |
392 | 0 | static struct { |
393 | 0 | PyGC_Head _this_is_not_used; |
394 | 0 | PyObject_VAR_HEAD |
395 | 0 | Py_hash_t ob_hash; |
396 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
397 | 0 | } _kwtuple = { |
398 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
399 | 0 | .ob_hash = -1, |
400 | 0 | .ob_item = { &_Py_ID(msg), }, |
401 | 0 | }; |
402 | 0 | #undef NUM_KEYWORDS |
403 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
404 | |
|
405 | | #else // !Py_BUILD_CORE |
406 | | # define KWTUPLE NULL |
407 | | #endif // !Py_BUILD_CORE |
408 | |
|
409 | 0 | static const char * const _keywords[] = {"msg", NULL}; |
410 | 0 | static _PyArg_Parser _parser = { |
411 | 0 | .keywords = _keywords, |
412 | 0 | .fname = "cancel", |
413 | 0 | .kwtuple = KWTUPLE, |
414 | 0 | }; |
415 | 0 | #undef KWTUPLE |
416 | 0 | PyObject *argsbuf[1]; |
417 | 0 | Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
418 | 0 | PyObject *msg = Py_None; |
419 | |
|
420 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
421 | 0 | /*minpos*/ 0, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
422 | 0 | if (!args) { |
423 | 0 | goto exit; |
424 | 0 | } |
425 | 0 | if (!noptargs) { |
426 | 0 | goto skip_optional_pos; |
427 | 0 | } |
428 | 0 | msg = args[0]; |
429 | 0 | skip_optional_pos: |
430 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
431 | 0 | return_value = _asyncio_Future_cancel_impl((FutureObj *)self, cls, msg); |
432 | 0 | Py_END_CRITICAL_SECTION(); |
433 | |
|
434 | 0 | exit: |
435 | 0 | return return_value; |
436 | 0 | } |
437 | | |
438 | | PyDoc_STRVAR(_asyncio_Future_cancelled__doc__, |
439 | | "cancelled($self, /)\n" |
440 | | "--\n" |
441 | | "\n" |
442 | | "Return True if the future was cancelled."); |
443 | | |
444 | | #define _ASYNCIO_FUTURE_CANCELLED_METHODDEF \ |
445 | | {"cancelled", (PyCFunction)_asyncio_Future_cancelled, METH_NOARGS, _asyncio_Future_cancelled__doc__}, |
446 | | |
447 | | static PyObject * |
448 | | _asyncio_Future_cancelled_impl(FutureObj *self); |
449 | | |
450 | | static PyObject * |
451 | | _asyncio_Future_cancelled(PyObject *self, PyObject *Py_UNUSED(ignored)) |
452 | 0 | { |
453 | 0 | PyObject *return_value = NULL; |
454 | |
|
455 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
456 | 0 | return_value = _asyncio_Future_cancelled_impl((FutureObj *)self); |
457 | 0 | Py_END_CRITICAL_SECTION(); |
458 | |
|
459 | 0 | return return_value; |
460 | 0 | } |
461 | | |
462 | | PyDoc_STRVAR(_asyncio_Future_done__doc__, |
463 | | "done($self, /)\n" |
464 | | "--\n" |
465 | | "\n" |
466 | | "Return True if the future is done.\n" |
467 | | "\n" |
468 | | "Done means either that a result / exception are available, or that the\n" |
469 | | "future was cancelled."); |
470 | | |
471 | | #define _ASYNCIO_FUTURE_DONE_METHODDEF \ |
472 | | {"done", (PyCFunction)_asyncio_Future_done, METH_NOARGS, _asyncio_Future_done__doc__}, |
473 | | |
474 | | static PyObject * |
475 | | _asyncio_Future_done_impl(FutureObj *self); |
476 | | |
477 | | static PyObject * |
478 | | _asyncio_Future_done(PyObject *self, PyObject *Py_UNUSED(ignored)) |
479 | 0 | { |
480 | 0 | PyObject *return_value = NULL; |
481 | |
|
482 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
483 | 0 | return_value = _asyncio_Future_done_impl((FutureObj *)self); |
484 | 0 | Py_END_CRITICAL_SECTION(); |
485 | |
|
486 | 0 | return return_value; |
487 | 0 | } |
488 | | |
489 | | PyDoc_STRVAR(_asyncio_Future_get_loop__doc__, |
490 | | "get_loop($self, /)\n" |
491 | | "--\n" |
492 | | "\n" |
493 | | "Return the event loop the Future is bound to."); |
494 | | |
495 | | #define _ASYNCIO_FUTURE_GET_LOOP_METHODDEF \ |
496 | | {"get_loop", _PyCFunction_CAST(_asyncio_Future_get_loop), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _asyncio_Future_get_loop__doc__}, |
497 | | |
498 | | static PyObject * |
499 | | _asyncio_Future_get_loop_impl(FutureObj *self, PyTypeObject *cls); |
500 | | |
501 | | static PyObject * |
502 | | _asyncio_Future_get_loop(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
503 | 0 | { |
504 | 0 | PyObject *return_value = NULL; |
505 | |
|
506 | 0 | if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) { |
507 | 0 | PyErr_SetString(PyExc_TypeError, "get_loop() takes no arguments"); |
508 | 0 | goto exit; |
509 | 0 | } |
510 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
511 | 0 | return_value = _asyncio_Future_get_loop_impl((FutureObj *)self, cls); |
512 | 0 | Py_END_CRITICAL_SECTION(); |
513 | |
|
514 | 0 | exit: |
515 | 0 | return return_value; |
516 | 0 | } |
517 | | |
518 | | #if !defined(_asyncio_Future__asyncio_awaited_by_DOCSTR) |
519 | | # define _asyncio_Future__asyncio_awaited_by_DOCSTR NULL |
520 | | #endif |
521 | | #if defined(_ASYNCIO_FUTURE__ASYNCIO_AWAITED_BY_GETSETDEF) |
522 | | # undef _ASYNCIO_FUTURE__ASYNCIO_AWAITED_BY_GETSETDEF |
523 | | # define _ASYNCIO_FUTURE__ASYNCIO_AWAITED_BY_GETSETDEF {"_asyncio_awaited_by", (getter)_asyncio_Future__asyncio_awaited_by_get, (setter)_asyncio_Future__asyncio_awaited_by_set, _asyncio_Future__asyncio_awaited_by_DOCSTR}, |
524 | | #else |
525 | | # define _ASYNCIO_FUTURE__ASYNCIO_AWAITED_BY_GETSETDEF {"_asyncio_awaited_by", (getter)_asyncio_Future__asyncio_awaited_by_get, NULL, _asyncio_Future__asyncio_awaited_by_DOCSTR}, |
526 | | #endif |
527 | | |
528 | | static PyObject * |
529 | | _asyncio_Future__asyncio_awaited_by_get_impl(FutureObj *self); |
530 | | |
531 | | static PyObject * |
532 | | _asyncio_Future__asyncio_awaited_by_get(PyObject *self, void *Py_UNUSED(context)) |
533 | 0 | { |
534 | 0 | PyObject *return_value = NULL; |
535 | |
|
536 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
537 | 0 | return_value = _asyncio_Future__asyncio_awaited_by_get_impl((FutureObj *)self); |
538 | 0 | Py_END_CRITICAL_SECTION(); |
539 | |
|
540 | 0 | return return_value; |
541 | 0 | } |
542 | | |
543 | | #if !defined(_asyncio_Future__asyncio_future_blocking_DOCSTR) |
544 | | # define _asyncio_Future__asyncio_future_blocking_DOCSTR NULL |
545 | | #endif |
546 | | #if defined(_ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF) |
547 | | # undef _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF |
548 | | # define _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF {"_asyncio_future_blocking", (getter)_asyncio_Future__asyncio_future_blocking_get, (setter)_asyncio_Future__asyncio_future_blocking_set, _asyncio_Future__asyncio_future_blocking_DOCSTR}, |
549 | | #else |
550 | | # define _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF {"_asyncio_future_blocking", (getter)_asyncio_Future__asyncio_future_blocking_get, NULL, _asyncio_Future__asyncio_future_blocking_DOCSTR}, |
551 | | #endif |
552 | | |
553 | | static PyObject * |
554 | | _asyncio_Future__asyncio_future_blocking_get_impl(FutureObj *self); |
555 | | |
556 | | static PyObject * |
557 | | _asyncio_Future__asyncio_future_blocking_get(PyObject *self, void *Py_UNUSED(context)) |
558 | 0 | { |
559 | 0 | PyObject *return_value = NULL; |
560 | |
|
561 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
562 | 0 | return_value = _asyncio_Future__asyncio_future_blocking_get_impl((FutureObj *)self); |
563 | 0 | Py_END_CRITICAL_SECTION(); |
564 | |
|
565 | 0 | return return_value; |
566 | 0 | } |
567 | | |
568 | | #if !defined(_asyncio_Future__asyncio_future_blocking_DOCSTR) |
569 | | # define _asyncio_Future__asyncio_future_blocking_DOCSTR NULL |
570 | | #endif |
571 | | #if defined(_ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF) |
572 | | # undef _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF |
573 | | # define _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF {"_asyncio_future_blocking", (getter)_asyncio_Future__asyncio_future_blocking_get, (setter)_asyncio_Future__asyncio_future_blocking_set, _asyncio_Future__asyncio_future_blocking_DOCSTR}, |
574 | | #else |
575 | | # define _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF {"_asyncio_future_blocking", NULL, (setter)_asyncio_Future__asyncio_future_blocking_set, NULL}, |
576 | | #endif |
577 | | |
578 | | static int |
579 | | _asyncio_Future__asyncio_future_blocking_set_impl(FutureObj *self, |
580 | | PyObject *value); |
581 | | |
582 | | static int |
583 | | _asyncio_Future__asyncio_future_blocking_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
584 | 0 | { |
585 | 0 | int return_value; |
586 | |
|
587 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
588 | 0 | return_value = _asyncio_Future__asyncio_future_blocking_set_impl((FutureObj *)self, value); |
589 | 0 | Py_END_CRITICAL_SECTION(); |
590 | |
|
591 | 0 | return return_value; |
592 | 0 | } |
593 | | |
594 | | #if !defined(_asyncio_Future__log_traceback_DOCSTR) |
595 | | # define _asyncio_Future__log_traceback_DOCSTR NULL |
596 | | #endif |
597 | | #if defined(_ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF) |
598 | | # undef _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF |
599 | | # define _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF {"_log_traceback", (getter)_asyncio_Future__log_traceback_get, (setter)_asyncio_Future__log_traceback_set, _asyncio_Future__log_traceback_DOCSTR}, |
600 | | #else |
601 | | # define _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF {"_log_traceback", (getter)_asyncio_Future__log_traceback_get, NULL, _asyncio_Future__log_traceback_DOCSTR}, |
602 | | #endif |
603 | | |
604 | | static PyObject * |
605 | | _asyncio_Future__log_traceback_get_impl(FutureObj *self); |
606 | | |
607 | | static PyObject * |
608 | | _asyncio_Future__log_traceback_get(PyObject *self, void *Py_UNUSED(context)) |
609 | 0 | { |
610 | 0 | PyObject *return_value = NULL; |
611 | |
|
612 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
613 | 0 | return_value = _asyncio_Future__log_traceback_get_impl((FutureObj *)self); |
614 | 0 | Py_END_CRITICAL_SECTION(); |
615 | |
|
616 | 0 | return return_value; |
617 | 0 | } |
618 | | |
619 | | #if !defined(_asyncio_Future__log_traceback_DOCSTR) |
620 | | # define _asyncio_Future__log_traceback_DOCSTR NULL |
621 | | #endif |
622 | | #if defined(_ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF) |
623 | | # undef _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF |
624 | | # define _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF {"_log_traceback", (getter)_asyncio_Future__log_traceback_get, (setter)_asyncio_Future__log_traceback_set, _asyncio_Future__log_traceback_DOCSTR}, |
625 | | #else |
626 | | # define _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF {"_log_traceback", NULL, (setter)_asyncio_Future__log_traceback_set, NULL}, |
627 | | #endif |
628 | | |
629 | | static int |
630 | | _asyncio_Future__log_traceback_set_impl(FutureObj *self, PyObject *value); |
631 | | |
632 | | static int |
633 | | _asyncio_Future__log_traceback_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
634 | 0 | { |
635 | 0 | int return_value; |
636 | |
|
637 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
638 | 0 | return_value = _asyncio_Future__log_traceback_set_impl((FutureObj *)self, value); |
639 | 0 | Py_END_CRITICAL_SECTION(); |
640 | |
|
641 | 0 | return return_value; |
642 | 0 | } |
643 | | |
644 | | #if !defined(_asyncio_Future__loop_DOCSTR) |
645 | | # define _asyncio_Future__loop_DOCSTR NULL |
646 | | #endif |
647 | | #if defined(_ASYNCIO_FUTURE__LOOP_GETSETDEF) |
648 | | # undef _ASYNCIO_FUTURE__LOOP_GETSETDEF |
649 | | # define _ASYNCIO_FUTURE__LOOP_GETSETDEF {"_loop", (getter)_asyncio_Future__loop_get, (setter)_asyncio_Future__loop_set, _asyncio_Future__loop_DOCSTR}, |
650 | | #else |
651 | | # define _ASYNCIO_FUTURE__LOOP_GETSETDEF {"_loop", (getter)_asyncio_Future__loop_get, NULL, _asyncio_Future__loop_DOCSTR}, |
652 | | #endif |
653 | | |
654 | | static PyObject * |
655 | | _asyncio_Future__loop_get_impl(FutureObj *self); |
656 | | |
657 | | static PyObject * |
658 | | _asyncio_Future__loop_get(PyObject *self, void *Py_UNUSED(context)) |
659 | 0 | { |
660 | 0 | PyObject *return_value = NULL; |
661 | |
|
662 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
663 | 0 | return_value = _asyncio_Future__loop_get_impl((FutureObj *)self); |
664 | 0 | Py_END_CRITICAL_SECTION(); |
665 | |
|
666 | 0 | return return_value; |
667 | 0 | } |
668 | | |
669 | | #if !defined(_asyncio_Future__callbacks_DOCSTR) |
670 | | # define _asyncio_Future__callbacks_DOCSTR NULL |
671 | | #endif |
672 | | #if defined(_ASYNCIO_FUTURE__CALLBACKS_GETSETDEF) |
673 | | # undef _ASYNCIO_FUTURE__CALLBACKS_GETSETDEF |
674 | | # define _ASYNCIO_FUTURE__CALLBACKS_GETSETDEF {"_callbacks", (getter)_asyncio_Future__callbacks_get, (setter)_asyncio_Future__callbacks_set, _asyncio_Future__callbacks_DOCSTR}, |
675 | | #else |
676 | | # define _ASYNCIO_FUTURE__CALLBACKS_GETSETDEF {"_callbacks", (getter)_asyncio_Future__callbacks_get, NULL, _asyncio_Future__callbacks_DOCSTR}, |
677 | | #endif |
678 | | |
679 | | static PyObject * |
680 | | _asyncio_Future__callbacks_get_impl(FutureObj *self); |
681 | | |
682 | | static PyObject * |
683 | | _asyncio_Future__callbacks_get(PyObject *self, void *Py_UNUSED(context)) |
684 | 0 | { |
685 | 0 | PyObject *return_value = NULL; |
686 | |
|
687 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
688 | 0 | return_value = _asyncio_Future__callbacks_get_impl((FutureObj *)self); |
689 | 0 | Py_END_CRITICAL_SECTION(); |
690 | |
|
691 | 0 | return return_value; |
692 | 0 | } |
693 | | |
694 | | #if !defined(_asyncio_Future__result_DOCSTR) |
695 | | # define _asyncio_Future__result_DOCSTR NULL |
696 | | #endif |
697 | | #if defined(_ASYNCIO_FUTURE__RESULT_GETSETDEF) |
698 | | # undef _ASYNCIO_FUTURE__RESULT_GETSETDEF |
699 | | # define _ASYNCIO_FUTURE__RESULT_GETSETDEF {"_result", (getter)_asyncio_Future__result_get, (setter)_asyncio_Future__result_set, _asyncio_Future__result_DOCSTR}, |
700 | | #else |
701 | | # define _ASYNCIO_FUTURE__RESULT_GETSETDEF {"_result", (getter)_asyncio_Future__result_get, NULL, _asyncio_Future__result_DOCSTR}, |
702 | | #endif |
703 | | |
704 | | static PyObject * |
705 | | _asyncio_Future__result_get_impl(FutureObj *self); |
706 | | |
707 | | static PyObject * |
708 | | _asyncio_Future__result_get(PyObject *self, void *Py_UNUSED(context)) |
709 | 0 | { |
710 | 0 | PyObject *return_value = NULL; |
711 | |
|
712 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
713 | 0 | return_value = _asyncio_Future__result_get_impl((FutureObj *)self); |
714 | 0 | Py_END_CRITICAL_SECTION(); |
715 | |
|
716 | 0 | return return_value; |
717 | 0 | } |
718 | | |
719 | | #if !defined(_asyncio_Future__exception_DOCSTR) |
720 | | # define _asyncio_Future__exception_DOCSTR NULL |
721 | | #endif |
722 | | #if defined(_ASYNCIO_FUTURE__EXCEPTION_GETSETDEF) |
723 | | # undef _ASYNCIO_FUTURE__EXCEPTION_GETSETDEF |
724 | | # define _ASYNCIO_FUTURE__EXCEPTION_GETSETDEF {"_exception", (getter)_asyncio_Future__exception_get, (setter)_asyncio_Future__exception_set, _asyncio_Future__exception_DOCSTR}, |
725 | | #else |
726 | | # define _ASYNCIO_FUTURE__EXCEPTION_GETSETDEF {"_exception", (getter)_asyncio_Future__exception_get, NULL, _asyncio_Future__exception_DOCSTR}, |
727 | | #endif |
728 | | |
729 | | static PyObject * |
730 | | _asyncio_Future__exception_get_impl(FutureObj *self); |
731 | | |
732 | | static PyObject * |
733 | | _asyncio_Future__exception_get(PyObject *self, void *Py_UNUSED(context)) |
734 | 0 | { |
735 | 0 | PyObject *return_value = NULL; |
736 | |
|
737 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
738 | 0 | return_value = _asyncio_Future__exception_get_impl((FutureObj *)self); |
739 | 0 | Py_END_CRITICAL_SECTION(); |
740 | |
|
741 | 0 | return return_value; |
742 | 0 | } |
743 | | |
744 | | #if !defined(_asyncio_Future__source_traceback_DOCSTR) |
745 | | # define _asyncio_Future__source_traceback_DOCSTR NULL |
746 | | #endif |
747 | | #if defined(_ASYNCIO_FUTURE__SOURCE_TRACEBACK_GETSETDEF) |
748 | | # undef _ASYNCIO_FUTURE__SOURCE_TRACEBACK_GETSETDEF |
749 | | # define _ASYNCIO_FUTURE__SOURCE_TRACEBACK_GETSETDEF {"_source_traceback", (getter)_asyncio_Future__source_traceback_get, (setter)_asyncio_Future__source_traceback_set, _asyncio_Future__source_traceback_DOCSTR}, |
750 | | #else |
751 | | # define _ASYNCIO_FUTURE__SOURCE_TRACEBACK_GETSETDEF {"_source_traceback", (getter)_asyncio_Future__source_traceback_get, NULL, _asyncio_Future__source_traceback_DOCSTR}, |
752 | | #endif |
753 | | |
754 | | static PyObject * |
755 | | _asyncio_Future__source_traceback_get_impl(FutureObj *self); |
756 | | |
757 | | static PyObject * |
758 | | _asyncio_Future__source_traceback_get(PyObject *self, void *Py_UNUSED(context)) |
759 | 0 | { |
760 | 0 | PyObject *return_value = NULL; |
761 | |
|
762 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
763 | 0 | return_value = _asyncio_Future__source_traceback_get_impl((FutureObj *)self); |
764 | 0 | Py_END_CRITICAL_SECTION(); |
765 | |
|
766 | 0 | return return_value; |
767 | 0 | } |
768 | | |
769 | | #if !defined(_asyncio_Future__cancel_message_DOCSTR) |
770 | | # define _asyncio_Future__cancel_message_DOCSTR NULL |
771 | | #endif |
772 | | #if defined(_ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF) |
773 | | # undef _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF |
774 | | # define _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF {"_cancel_message", (getter)_asyncio_Future__cancel_message_get, (setter)_asyncio_Future__cancel_message_set, _asyncio_Future__cancel_message_DOCSTR}, |
775 | | #else |
776 | | # define _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF {"_cancel_message", (getter)_asyncio_Future__cancel_message_get, NULL, _asyncio_Future__cancel_message_DOCSTR}, |
777 | | #endif |
778 | | |
779 | | static PyObject * |
780 | | _asyncio_Future__cancel_message_get_impl(FutureObj *self); |
781 | | |
782 | | static PyObject * |
783 | | _asyncio_Future__cancel_message_get(PyObject *self, void *Py_UNUSED(context)) |
784 | 0 | { |
785 | 0 | PyObject *return_value = NULL; |
786 | |
|
787 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
788 | 0 | return_value = _asyncio_Future__cancel_message_get_impl((FutureObj *)self); |
789 | 0 | Py_END_CRITICAL_SECTION(); |
790 | |
|
791 | 0 | return return_value; |
792 | 0 | } |
793 | | |
794 | | #if !defined(_asyncio_Future__cancel_message_DOCSTR) |
795 | | # define _asyncio_Future__cancel_message_DOCSTR NULL |
796 | | #endif |
797 | | #if defined(_ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF) |
798 | | # undef _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF |
799 | | # define _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF {"_cancel_message", (getter)_asyncio_Future__cancel_message_get, (setter)_asyncio_Future__cancel_message_set, _asyncio_Future__cancel_message_DOCSTR}, |
800 | | #else |
801 | | # define _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF {"_cancel_message", NULL, (setter)_asyncio_Future__cancel_message_set, NULL}, |
802 | | #endif |
803 | | |
804 | | static int |
805 | | _asyncio_Future__cancel_message_set_impl(FutureObj *self, PyObject *value); |
806 | | |
807 | | static int |
808 | | _asyncio_Future__cancel_message_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
809 | 0 | { |
810 | 0 | int return_value; |
811 | |
|
812 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
813 | 0 | return_value = _asyncio_Future__cancel_message_set_impl((FutureObj *)self, value); |
814 | 0 | Py_END_CRITICAL_SECTION(); |
815 | |
|
816 | 0 | return return_value; |
817 | 0 | } |
818 | | |
819 | | #if !defined(_asyncio_Future__state_DOCSTR) |
820 | | # define _asyncio_Future__state_DOCSTR NULL |
821 | | #endif |
822 | | #if defined(_ASYNCIO_FUTURE__STATE_GETSETDEF) |
823 | | # undef _ASYNCIO_FUTURE__STATE_GETSETDEF |
824 | | # define _ASYNCIO_FUTURE__STATE_GETSETDEF {"_state", (getter)_asyncio_Future__state_get, (setter)_asyncio_Future__state_set, _asyncio_Future__state_DOCSTR}, |
825 | | #else |
826 | | # define _ASYNCIO_FUTURE__STATE_GETSETDEF {"_state", (getter)_asyncio_Future__state_get, NULL, _asyncio_Future__state_DOCSTR}, |
827 | | #endif |
828 | | |
829 | | static PyObject * |
830 | | _asyncio_Future__state_get_impl(FutureObj *self); |
831 | | |
832 | | static PyObject * |
833 | | _asyncio_Future__state_get(PyObject *self, void *Py_UNUSED(context)) |
834 | 0 | { |
835 | 0 | PyObject *return_value = NULL; |
836 | |
|
837 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
838 | 0 | return_value = _asyncio_Future__state_get_impl((FutureObj *)self); |
839 | 0 | Py_END_CRITICAL_SECTION(); |
840 | |
|
841 | 0 | return return_value; |
842 | 0 | } |
843 | | |
844 | | PyDoc_STRVAR(_asyncio_Future__make_cancelled_error__doc__, |
845 | | "_make_cancelled_error($self, /)\n" |
846 | | "--\n" |
847 | | "\n" |
848 | | "Create the CancelledError to raise if the Future is cancelled.\n" |
849 | | "\n" |
850 | | "This should only be called once when handling a cancellation since\n" |
851 | | "it erases the context exception value."); |
852 | | |
853 | | #define _ASYNCIO_FUTURE__MAKE_CANCELLED_ERROR_METHODDEF \ |
854 | | {"_make_cancelled_error", (PyCFunction)_asyncio_Future__make_cancelled_error, METH_NOARGS, _asyncio_Future__make_cancelled_error__doc__}, |
855 | | |
856 | | static PyObject * |
857 | | _asyncio_Future__make_cancelled_error_impl(FutureObj *self); |
858 | | |
859 | | static PyObject * |
860 | | _asyncio_Future__make_cancelled_error(PyObject *self, PyObject *Py_UNUSED(ignored)) |
861 | 0 | { |
862 | 0 | PyObject *return_value = NULL; |
863 | |
|
864 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
865 | 0 | return_value = _asyncio_Future__make_cancelled_error_impl((FutureObj *)self); |
866 | 0 | Py_END_CRITICAL_SECTION(); |
867 | |
|
868 | 0 | return return_value; |
869 | 0 | } |
870 | | |
871 | | PyDoc_STRVAR(_asyncio_Task___init____doc__, |
872 | | "Task(coro, *, loop=None, name=None, context=None, eager_start=False)\n" |
873 | | "--\n" |
874 | | "\n" |
875 | | "A coroutine wrapped in a Future."); |
876 | | |
877 | | static int |
878 | | _asyncio_Task___init___impl(TaskObj *self, PyObject *coro, PyObject *loop, |
879 | | PyObject *name, PyObject *context, |
880 | | int eager_start); |
881 | | |
882 | | static int |
883 | | _asyncio_Task___init__(PyObject *self, PyObject *args, PyObject *kwargs) |
884 | 0 | { |
885 | 0 | int return_value = -1; |
886 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
887 | |
|
888 | 0 | #define NUM_KEYWORDS 5 |
889 | 0 | static struct { |
890 | 0 | PyGC_Head _this_is_not_used; |
891 | 0 | PyObject_VAR_HEAD |
892 | 0 | Py_hash_t ob_hash; |
893 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
894 | 0 | } _kwtuple = { |
895 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
896 | 0 | .ob_hash = -1, |
897 | 0 | .ob_item = { &_Py_ID(coro), &_Py_ID(loop), &_Py_ID(name), &_Py_ID(context), &_Py_ID(eager_start), }, |
898 | 0 | }; |
899 | 0 | #undef NUM_KEYWORDS |
900 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
901 | |
|
902 | | #else // !Py_BUILD_CORE |
903 | | # define KWTUPLE NULL |
904 | | #endif // !Py_BUILD_CORE |
905 | |
|
906 | 0 | static const char * const _keywords[] = {"coro", "loop", "name", "context", "eager_start", NULL}; |
907 | 0 | static _PyArg_Parser _parser = { |
908 | 0 | .keywords = _keywords, |
909 | 0 | .fname = "Task", |
910 | 0 | .kwtuple = KWTUPLE, |
911 | 0 | }; |
912 | 0 | #undef KWTUPLE |
913 | 0 | PyObject *argsbuf[5]; |
914 | 0 | PyObject * const *fastargs; |
915 | 0 | Py_ssize_t nargs = PyTuple_GET_SIZE(args); |
916 | 0 | Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1; |
917 | 0 | PyObject *coro; |
918 | 0 | PyObject *loop = Py_None; |
919 | 0 | PyObject *name = Py_None; |
920 | 0 | PyObject *context = Py_None; |
921 | 0 | int eager_start = 0; |
922 | |
|
923 | 0 | fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, |
924 | 0 | /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
925 | 0 | if (!fastargs) { |
926 | 0 | goto exit; |
927 | 0 | } |
928 | 0 | coro = fastargs[0]; |
929 | 0 | if (!noptargs) { |
930 | 0 | goto skip_optional_kwonly; |
931 | 0 | } |
932 | 0 | if (fastargs[1]) { |
933 | 0 | loop = fastargs[1]; |
934 | 0 | if (!--noptargs) { |
935 | 0 | goto skip_optional_kwonly; |
936 | 0 | } |
937 | 0 | } |
938 | 0 | if (fastargs[2]) { |
939 | 0 | name = fastargs[2]; |
940 | 0 | if (!--noptargs) { |
941 | 0 | goto skip_optional_kwonly; |
942 | 0 | } |
943 | 0 | } |
944 | 0 | if (fastargs[3]) { |
945 | 0 | context = fastargs[3]; |
946 | 0 | if (!--noptargs) { |
947 | 0 | goto skip_optional_kwonly; |
948 | 0 | } |
949 | 0 | } |
950 | 0 | eager_start = PyObject_IsTrue(fastargs[4]); |
951 | 0 | if (eager_start < 0) { |
952 | 0 | goto exit; |
953 | 0 | } |
954 | 0 | skip_optional_kwonly: |
955 | 0 | return_value = _asyncio_Task___init___impl((TaskObj *)self, coro, loop, name, context, eager_start); |
956 | |
|
957 | 0 | exit: |
958 | 0 | return return_value; |
959 | 0 | } |
960 | | |
961 | | #if !defined(_asyncio_Task__log_destroy_pending_DOCSTR) |
962 | | # define _asyncio_Task__log_destroy_pending_DOCSTR NULL |
963 | | #endif |
964 | | #if defined(_ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF) |
965 | | # undef _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF |
966 | | # define _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF {"_log_destroy_pending", (getter)_asyncio_Task__log_destroy_pending_get, (setter)_asyncio_Task__log_destroy_pending_set, _asyncio_Task__log_destroy_pending_DOCSTR}, |
967 | | #else |
968 | | # define _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF {"_log_destroy_pending", (getter)_asyncio_Task__log_destroy_pending_get, NULL, _asyncio_Task__log_destroy_pending_DOCSTR}, |
969 | | #endif |
970 | | |
971 | | static PyObject * |
972 | | _asyncio_Task__log_destroy_pending_get_impl(TaskObj *self); |
973 | | |
974 | | static PyObject * |
975 | | _asyncio_Task__log_destroy_pending_get(PyObject *self, void *Py_UNUSED(context)) |
976 | 0 | { |
977 | 0 | PyObject *return_value = NULL; |
978 | |
|
979 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
980 | 0 | return_value = _asyncio_Task__log_destroy_pending_get_impl((TaskObj *)self); |
981 | 0 | Py_END_CRITICAL_SECTION(); |
982 | |
|
983 | 0 | return return_value; |
984 | 0 | } |
985 | | |
986 | | #if !defined(_asyncio_Task__log_destroy_pending_DOCSTR) |
987 | | # define _asyncio_Task__log_destroy_pending_DOCSTR NULL |
988 | | #endif |
989 | | #if defined(_ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF) |
990 | | # undef _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF |
991 | | # define _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF {"_log_destroy_pending", (getter)_asyncio_Task__log_destroy_pending_get, (setter)_asyncio_Task__log_destroy_pending_set, _asyncio_Task__log_destroy_pending_DOCSTR}, |
992 | | #else |
993 | | # define _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF {"_log_destroy_pending", NULL, (setter)_asyncio_Task__log_destroy_pending_set, NULL}, |
994 | | #endif |
995 | | |
996 | | static int |
997 | | _asyncio_Task__log_destroy_pending_set_impl(TaskObj *self, PyObject *value); |
998 | | |
999 | | static int |
1000 | | _asyncio_Task__log_destroy_pending_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
1001 | 0 | { |
1002 | 0 | int return_value; |
1003 | |
|
1004 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
1005 | 0 | return_value = _asyncio_Task__log_destroy_pending_set_impl((TaskObj *)self, value); |
1006 | 0 | Py_END_CRITICAL_SECTION(); |
1007 | |
|
1008 | 0 | return return_value; |
1009 | 0 | } |
1010 | | |
1011 | | #if !defined(_asyncio_Task__must_cancel_DOCSTR) |
1012 | | # define _asyncio_Task__must_cancel_DOCSTR NULL |
1013 | | #endif |
1014 | | #if defined(_ASYNCIO_TASK__MUST_CANCEL_GETSETDEF) |
1015 | | # undef _ASYNCIO_TASK__MUST_CANCEL_GETSETDEF |
1016 | | # define _ASYNCIO_TASK__MUST_CANCEL_GETSETDEF {"_must_cancel", (getter)_asyncio_Task__must_cancel_get, (setter)_asyncio_Task__must_cancel_set, _asyncio_Task__must_cancel_DOCSTR}, |
1017 | | #else |
1018 | | # define _ASYNCIO_TASK__MUST_CANCEL_GETSETDEF {"_must_cancel", (getter)_asyncio_Task__must_cancel_get, NULL, _asyncio_Task__must_cancel_DOCSTR}, |
1019 | | #endif |
1020 | | |
1021 | | static PyObject * |
1022 | | _asyncio_Task__must_cancel_get_impl(TaskObj *self); |
1023 | | |
1024 | | static PyObject * |
1025 | | _asyncio_Task__must_cancel_get(PyObject *self, void *Py_UNUSED(context)) |
1026 | 0 | { |
1027 | 0 | PyObject *return_value = NULL; |
1028 | |
|
1029 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
1030 | 0 | return_value = _asyncio_Task__must_cancel_get_impl((TaskObj *)self); |
1031 | 0 | Py_END_CRITICAL_SECTION(); |
1032 | |
|
1033 | 0 | return return_value; |
1034 | 0 | } |
1035 | | |
1036 | | #if !defined(_asyncio_Task__coro_DOCSTR) |
1037 | | # define _asyncio_Task__coro_DOCSTR NULL |
1038 | | #endif |
1039 | | #if defined(_ASYNCIO_TASK__CORO_GETSETDEF) |
1040 | | # undef _ASYNCIO_TASK__CORO_GETSETDEF |
1041 | | # define _ASYNCIO_TASK__CORO_GETSETDEF {"_coro", (getter)_asyncio_Task__coro_get, (setter)_asyncio_Task__coro_set, _asyncio_Task__coro_DOCSTR}, |
1042 | | #else |
1043 | | # define _ASYNCIO_TASK__CORO_GETSETDEF {"_coro", (getter)_asyncio_Task__coro_get, NULL, _asyncio_Task__coro_DOCSTR}, |
1044 | | #endif |
1045 | | |
1046 | | static PyObject * |
1047 | | _asyncio_Task__coro_get_impl(TaskObj *self); |
1048 | | |
1049 | | static PyObject * |
1050 | | _asyncio_Task__coro_get(PyObject *self, void *Py_UNUSED(context)) |
1051 | 0 | { |
1052 | 0 | PyObject *return_value = NULL; |
1053 | |
|
1054 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
1055 | 0 | return_value = _asyncio_Task__coro_get_impl((TaskObj *)self); |
1056 | 0 | Py_END_CRITICAL_SECTION(); |
1057 | |
|
1058 | 0 | return return_value; |
1059 | 0 | } |
1060 | | |
1061 | | #if !defined(_asyncio_Task__fut_waiter_DOCSTR) |
1062 | | # define _asyncio_Task__fut_waiter_DOCSTR NULL |
1063 | | #endif |
1064 | | #if defined(_ASYNCIO_TASK__FUT_WAITER_GETSETDEF) |
1065 | | # undef _ASYNCIO_TASK__FUT_WAITER_GETSETDEF |
1066 | | # define _ASYNCIO_TASK__FUT_WAITER_GETSETDEF {"_fut_waiter", (getter)_asyncio_Task__fut_waiter_get, (setter)_asyncio_Task__fut_waiter_set, _asyncio_Task__fut_waiter_DOCSTR}, |
1067 | | #else |
1068 | | # define _ASYNCIO_TASK__FUT_WAITER_GETSETDEF {"_fut_waiter", (getter)_asyncio_Task__fut_waiter_get, NULL, _asyncio_Task__fut_waiter_DOCSTR}, |
1069 | | #endif |
1070 | | |
1071 | | static PyObject * |
1072 | | _asyncio_Task__fut_waiter_get_impl(TaskObj *self); |
1073 | | |
1074 | | static PyObject * |
1075 | | _asyncio_Task__fut_waiter_get(PyObject *self, void *Py_UNUSED(context)) |
1076 | 0 | { |
1077 | 0 | PyObject *return_value = NULL; |
1078 | |
|
1079 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
1080 | 0 | return_value = _asyncio_Task__fut_waiter_get_impl((TaskObj *)self); |
1081 | 0 | Py_END_CRITICAL_SECTION(); |
1082 | |
|
1083 | 0 | return return_value; |
1084 | 0 | } |
1085 | | |
1086 | | PyDoc_STRVAR(_asyncio_Task__make_cancelled_error__doc__, |
1087 | | "_make_cancelled_error($self, /)\n" |
1088 | | "--\n" |
1089 | | "\n" |
1090 | | "Create the CancelledError to raise if the Task is cancelled.\n" |
1091 | | "\n" |
1092 | | "This should only be called once when handling a cancellation since\n" |
1093 | | "it erases the context exception value."); |
1094 | | |
1095 | | #define _ASYNCIO_TASK__MAKE_CANCELLED_ERROR_METHODDEF \ |
1096 | | {"_make_cancelled_error", (PyCFunction)_asyncio_Task__make_cancelled_error, METH_NOARGS, _asyncio_Task__make_cancelled_error__doc__}, |
1097 | | |
1098 | | static PyObject * |
1099 | | _asyncio_Task__make_cancelled_error_impl(TaskObj *self); |
1100 | | |
1101 | | static PyObject * |
1102 | | _asyncio_Task__make_cancelled_error(PyObject *self, PyObject *Py_UNUSED(ignored)) |
1103 | 0 | { |
1104 | 0 | PyObject *return_value = NULL; |
1105 | |
|
1106 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
1107 | 0 | return_value = _asyncio_Task__make_cancelled_error_impl((TaskObj *)self); |
1108 | 0 | Py_END_CRITICAL_SECTION(); |
1109 | |
|
1110 | 0 | return return_value; |
1111 | 0 | } |
1112 | | |
1113 | | PyDoc_STRVAR(_asyncio_Task_cancel__doc__, |
1114 | | "cancel($self, /, msg=None)\n" |
1115 | | "--\n" |
1116 | | "\n" |
1117 | | "Request that this task cancel itself.\n" |
1118 | | "\n" |
1119 | | "This arranges for a CancelledError to be thrown into the\n" |
1120 | | "wrapped coroutine on the next cycle through the event loop.\n" |
1121 | | "The coroutine then has a chance to clean up or even deny\n" |
1122 | | "the request using try/except/finally.\n" |
1123 | | "\n" |
1124 | | "Unlike Future.cancel, this does not guarantee that the\n" |
1125 | | "task will be cancelled: the exception might be caught and\n" |
1126 | | "acted upon, delaying cancellation of the task or preventing\n" |
1127 | | "cancellation completely. The task may also return a value or\n" |
1128 | | "raise a different exception.\n" |
1129 | | "\n" |
1130 | | "Immediately after this method is called, Task.cancelled() will\n" |
1131 | | "not return True (unless the task was already cancelled). A\n" |
1132 | | "task will be marked as cancelled when the wrapped coroutine\n" |
1133 | | "terminates with a CancelledError exception (even if cancel()\n" |
1134 | | "was not called).\n" |
1135 | | "\n" |
1136 | | "This also increases the task\'s count of cancellation requests."); |
1137 | | |
1138 | | #define _ASYNCIO_TASK_CANCEL_METHODDEF \ |
1139 | | {"cancel", _PyCFunction_CAST(_asyncio_Task_cancel), METH_FASTCALL|METH_KEYWORDS, _asyncio_Task_cancel__doc__}, |
1140 | | |
1141 | | static PyObject * |
1142 | | _asyncio_Task_cancel_impl(TaskObj *self, PyObject *msg); |
1143 | | |
1144 | | static PyObject * |
1145 | | _asyncio_Task_cancel(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
1146 | 0 | { |
1147 | 0 | PyObject *return_value = NULL; |
1148 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
1149 | |
|
1150 | 0 | #define NUM_KEYWORDS 1 |
1151 | 0 | static struct { |
1152 | 0 | PyGC_Head _this_is_not_used; |
1153 | 0 | PyObject_VAR_HEAD |
1154 | 0 | Py_hash_t ob_hash; |
1155 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
1156 | 0 | } _kwtuple = { |
1157 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
1158 | 0 | .ob_hash = -1, |
1159 | 0 | .ob_item = { &_Py_ID(msg), }, |
1160 | 0 | }; |
1161 | 0 | #undef NUM_KEYWORDS |
1162 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
1163 | |
|
1164 | | #else // !Py_BUILD_CORE |
1165 | | # define KWTUPLE NULL |
1166 | | #endif // !Py_BUILD_CORE |
1167 | |
|
1168 | 0 | static const char * const _keywords[] = {"msg", NULL}; |
1169 | 0 | static _PyArg_Parser _parser = { |
1170 | 0 | .keywords = _keywords, |
1171 | 0 | .fname = "cancel", |
1172 | 0 | .kwtuple = KWTUPLE, |
1173 | 0 | }; |
1174 | 0 | #undef KWTUPLE |
1175 | 0 | PyObject *argsbuf[1]; |
1176 | 0 | Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
1177 | 0 | PyObject *msg = Py_None; |
1178 | |
|
1179 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
1180 | 0 | /*minpos*/ 0, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
1181 | 0 | if (!args) { |
1182 | 0 | goto exit; |
1183 | 0 | } |
1184 | 0 | if (!noptargs) { |
1185 | 0 | goto skip_optional_pos; |
1186 | 0 | } |
1187 | 0 | msg = args[0]; |
1188 | 0 | skip_optional_pos: |
1189 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
1190 | 0 | return_value = _asyncio_Task_cancel_impl((TaskObj *)self, msg); |
1191 | 0 | Py_END_CRITICAL_SECTION(); |
1192 | |
|
1193 | 0 | exit: |
1194 | 0 | return return_value; |
1195 | 0 | } |
1196 | | |
1197 | | PyDoc_STRVAR(_asyncio_Task_cancelling__doc__, |
1198 | | "cancelling($self, /)\n" |
1199 | | "--\n" |
1200 | | "\n" |
1201 | | "Return the count of the task\'s cancellation requests.\n" |
1202 | | "\n" |
1203 | | "This count is incremented when .cancel() is called\n" |
1204 | | "and may be decremented using .uncancel()."); |
1205 | | |
1206 | | #define _ASYNCIO_TASK_CANCELLING_METHODDEF \ |
1207 | | {"cancelling", (PyCFunction)_asyncio_Task_cancelling, METH_NOARGS, _asyncio_Task_cancelling__doc__}, |
1208 | | |
1209 | | static PyObject * |
1210 | | _asyncio_Task_cancelling_impl(TaskObj *self); |
1211 | | |
1212 | | static PyObject * |
1213 | | _asyncio_Task_cancelling(PyObject *self, PyObject *Py_UNUSED(ignored)) |
1214 | 0 | { |
1215 | 0 | PyObject *return_value = NULL; |
1216 | |
|
1217 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
1218 | 0 | return_value = _asyncio_Task_cancelling_impl((TaskObj *)self); |
1219 | 0 | Py_END_CRITICAL_SECTION(); |
1220 | |
|
1221 | 0 | return return_value; |
1222 | 0 | } |
1223 | | |
1224 | | PyDoc_STRVAR(_asyncio_Task_uncancel__doc__, |
1225 | | "uncancel($self, /)\n" |
1226 | | "--\n" |
1227 | | "\n" |
1228 | | "Decrement the task\'s count of cancellation requests.\n" |
1229 | | "\n" |
1230 | | "This should be used by tasks that catch CancelledError\n" |
1231 | | "and wish to continue indefinitely until they are cancelled again.\n" |
1232 | | "\n" |
1233 | | "Returns the remaining number of cancellation requests."); |
1234 | | |
1235 | | #define _ASYNCIO_TASK_UNCANCEL_METHODDEF \ |
1236 | | {"uncancel", (PyCFunction)_asyncio_Task_uncancel, METH_NOARGS, _asyncio_Task_uncancel__doc__}, |
1237 | | |
1238 | | static PyObject * |
1239 | | _asyncio_Task_uncancel_impl(TaskObj *self); |
1240 | | |
1241 | | static PyObject * |
1242 | | _asyncio_Task_uncancel(PyObject *self, PyObject *Py_UNUSED(ignored)) |
1243 | 0 | { |
1244 | 0 | PyObject *return_value = NULL; |
1245 | |
|
1246 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
1247 | 0 | return_value = _asyncio_Task_uncancel_impl((TaskObj *)self); |
1248 | 0 | Py_END_CRITICAL_SECTION(); |
1249 | |
|
1250 | 0 | return return_value; |
1251 | 0 | } |
1252 | | |
1253 | | PyDoc_STRVAR(_asyncio_Task_get_stack__doc__, |
1254 | | "get_stack($self, /, *, limit=None)\n" |
1255 | | "--\n" |
1256 | | "\n" |
1257 | | "Return the list of stack frames for this task\'s coroutine.\n" |
1258 | | "\n" |
1259 | | "If the coroutine is not done, this returns the stack where it is\n" |
1260 | | "suspended. If the coroutine has completed successfully or was\n" |
1261 | | "cancelled, this returns an empty list. If the coroutine was\n" |
1262 | | "terminated by an exception, this returns the list of traceback\n" |
1263 | | "frames.\n" |
1264 | | "\n" |
1265 | | "The frames are always ordered from oldest to newest.\n" |
1266 | | "\n" |
1267 | | "The optional limit gives the maximum number of frames to\n" |
1268 | | "return; by default all available frames are returned. Its\n" |
1269 | | "meaning differs depending on whether a stack or a traceback is\n" |
1270 | | "returned: the newest frames of a stack are returned, but the\n" |
1271 | | "oldest frames of a traceback are returned. (This matches the\n" |
1272 | | "behavior of the traceback module.)\n" |
1273 | | "\n" |
1274 | | "For reasons beyond our control, only one stack frame is\n" |
1275 | | "returned for a suspended coroutine."); |
1276 | | |
1277 | | #define _ASYNCIO_TASK_GET_STACK_METHODDEF \ |
1278 | | {"get_stack", _PyCFunction_CAST(_asyncio_Task_get_stack), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _asyncio_Task_get_stack__doc__}, |
1279 | | |
1280 | | static PyObject * |
1281 | | _asyncio_Task_get_stack_impl(TaskObj *self, PyTypeObject *cls, |
1282 | | PyObject *limit); |
1283 | | |
1284 | | static PyObject * |
1285 | | _asyncio_Task_get_stack(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
1286 | 0 | { |
1287 | 0 | PyObject *return_value = NULL; |
1288 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
1289 | |
|
1290 | 0 | #define NUM_KEYWORDS 1 |
1291 | 0 | static struct { |
1292 | 0 | PyGC_Head _this_is_not_used; |
1293 | 0 | PyObject_VAR_HEAD |
1294 | 0 | Py_hash_t ob_hash; |
1295 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
1296 | 0 | } _kwtuple = { |
1297 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
1298 | 0 | .ob_hash = -1, |
1299 | 0 | .ob_item = { &_Py_ID(limit), }, |
1300 | 0 | }; |
1301 | 0 | #undef NUM_KEYWORDS |
1302 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
1303 | |
|
1304 | | #else // !Py_BUILD_CORE |
1305 | | # define KWTUPLE NULL |
1306 | | #endif // !Py_BUILD_CORE |
1307 | |
|
1308 | 0 | static const char * const _keywords[] = {"limit", NULL}; |
1309 | 0 | static _PyArg_Parser _parser = { |
1310 | 0 | .keywords = _keywords, |
1311 | 0 | .fname = "get_stack", |
1312 | 0 | .kwtuple = KWTUPLE, |
1313 | 0 | }; |
1314 | 0 | #undef KWTUPLE |
1315 | 0 | PyObject *argsbuf[1]; |
1316 | 0 | Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
1317 | 0 | PyObject *limit = Py_None; |
1318 | |
|
1319 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
1320 | 0 | /*minpos*/ 0, /*maxpos*/ 0, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
1321 | 0 | if (!args) { |
1322 | 0 | goto exit; |
1323 | 0 | } |
1324 | 0 | if (!noptargs) { |
1325 | 0 | goto skip_optional_kwonly; |
1326 | 0 | } |
1327 | 0 | limit = args[0]; |
1328 | 0 | skip_optional_kwonly: |
1329 | 0 | return_value = _asyncio_Task_get_stack_impl((TaskObj *)self, cls, limit); |
1330 | |
|
1331 | 0 | exit: |
1332 | 0 | return return_value; |
1333 | 0 | } |
1334 | | |
1335 | | PyDoc_STRVAR(_asyncio_Task_print_stack__doc__, |
1336 | | "print_stack($self, /, *, limit=None, file=None)\n" |
1337 | | "--\n" |
1338 | | "\n" |
1339 | | "Print the stack or traceback for this task\'s coroutine.\n" |
1340 | | "\n" |
1341 | | "This produces output similar to that of the traceback module,\n" |
1342 | | "for the frames retrieved by get_stack(). The limit argument\n" |
1343 | | "is passed to get_stack(). The file argument is an I/O stream\n" |
1344 | | "to which the output is written; by default output is written\n" |
1345 | | "to sys.stderr."); |
1346 | | |
1347 | | #define _ASYNCIO_TASK_PRINT_STACK_METHODDEF \ |
1348 | | {"print_stack", _PyCFunction_CAST(_asyncio_Task_print_stack), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _asyncio_Task_print_stack__doc__}, |
1349 | | |
1350 | | static PyObject * |
1351 | | _asyncio_Task_print_stack_impl(TaskObj *self, PyTypeObject *cls, |
1352 | | PyObject *limit, PyObject *file); |
1353 | | |
1354 | | static PyObject * |
1355 | | _asyncio_Task_print_stack(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
1356 | 0 | { |
1357 | 0 | PyObject *return_value = NULL; |
1358 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
1359 | |
|
1360 | 0 | #define NUM_KEYWORDS 2 |
1361 | 0 | static struct { |
1362 | 0 | PyGC_Head _this_is_not_used; |
1363 | 0 | PyObject_VAR_HEAD |
1364 | 0 | Py_hash_t ob_hash; |
1365 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
1366 | 0 | } _kwtuple = { |
1367 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
1368 | 0 | .ob_hash = -1, |
1369 | 0 | .ob_item = { &_Py_ID(limit), &_Py_ID(file), }, |
1370 | 0 | }; |
1371 | 0 | #undef NUM_KEYWORDS |
1372 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
1373 | |
|
1374 | | #else // !Py_BUILD_CORE |
1375 | | # define KWTUPLE NULL |
1376 | | #endif // !Py_BUILD_CORE |
1377 | |
|
1378 | 0 | static const char * const _keywords[] = {"limit", "file", NULL}; |
1379 | 0 | static _PyArg_Parser _parser = { |
1380 | 0 | .keywords = _keywords, |
1381 | 0 | .fname = "print_stack", |
1382 | 0 | .kwtuple = KWTUPLE, |
1383 | 0 | }; |
1384 | 0 | #undef KWTUPLE |
1385 | 0 | PyObject *argsbuf[2]; |
1386 | 0 | Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
1387 | 0 | PyObject *limit = Py_None; |
1388 | 0 | PyObject *file = Py_None; |
1389 | |
|
1390 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
1391 | 0 | /*minpos*/ 0, /*maxpos*/ 0, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
1392 | 0 | if (!args) { |
1393 | 0 | goto exit; |
1394 | 0 | } |
1395 | 0 | if (!noptargs) { |
1396 | 0 | goto skip_optional_kwonly; |
1397 | 0 | } |
1398 | 0 | if (args[0]) { |
1399 | 0 | limit = args[0]; |
1400 | 0 | if (!--noptargs) { |
1401 | 0 | goto skip_optional_kwonly; |
1402 | 0 | } |
1403 | 0 | } |
1404 | 0 | file = args[1]; |
1405 | 0 | skip_optional_kwonly: |
1406 | 0 | return_value = _asyncio_Task_print_stack_impl((TaskObj *)self, cls, limit, file); |
1407 | |
|
1408 | 0 | exit: |
1409 | 0 | return return_value; |
1410 | 0 | } |
1411 | | |
1412 | | PyDoc_STRVAR(_asyncio_Task_set_result__doc__, |
1413 | | "set_result($self, result, /)\n" |
1414 | | "--\n" |
1415 | | "\n"); |
1416 | | |
1417 | | #define _ASYNCIO_TASK_SET_RESULT_METHODDEF \ |
1418 | | {"set_result", (PyCFunction)_asyncio_Task_set_result, METH_O, _asyncio_Task_set_result__doc__}, |
1419 | | |
1420 | | static PyObject * |
1421 | | _asyncio_Task_set_result_impl(TaskObj *self, PyObject *result); |
1422 | | |
1423 | | static PyObject * |
1424 | | _asyncio_Task_set_result(PyObject *self, PyObject *result) |
1425 | 0 | { |
1426 | 0 | PyObject *return_value = NULL; |
1427 | |
|
1428 | 0 | return_value = _asyncio_Task_set_result_impl((TaskObj *)self, result); |
1429 | |
|
1430 | 0 | return return_value; |
1431 | 0 | } |
1432 | | |
1433 | | PyDoc_STRVAR(_asyncio_Task_set_exception__doc__, |
1434 | | "set_exception($self, exception, /)\n" |
1435 | | "--\n" |
1436 | | "\n"); |
1437 | | |
1438 | | #define _ASYNCIO_TASK_SET_EXCEPTION_METHODDEF \ |
1439 | | {"set_exception", (PyCFunction)_asyncio_Task_set_exception, METH_O, _asyncio_Task_set_exception__doc__}, |
1440 | | |
1441 | | static PyObject * |
1442 | | _asyncio_Task_set_exception_impl(TaskObj *self, PyObject *exception); |
1443 | | |
1444 | | static PyObject * |
1445 | | _asyncio_Task_set_exception(PyObject *self, PyObject *exception) |
1446 | 0 | { |
1447 | 0 | PyObject *return_value = NULL; |
1448 | |
|
1449 | 0 | return_value = _asyncio_Task_set_exception_impl((TaskObj *)self, exception); |
1450 | |
|
1451 | 0 | return return_value; |
1452 | 0 | } |
1453 | | |
1454 | | PyDoc_STRVAR(_asyncio_Task_get_coro__doc__, |
1455 | | "get_coro($self, /)\n" |
1456 | | "--\n" |
1457 | | "\n"); |
1458 | | |
1459 | | #define _ASYNCIO_TASK_GET_CORO_METHODDEF \ |
1460 | | {"get_coro", (PyCFunction)_asyncio_Task_get_coro, METH_NOARGS, _asyncio_Task_get_coro__doc__}, |
1461 | | |
1462 | | static PyObject * |
1463 | | _asyncio_Task_get_coro_impl(TaskObj *self); |
1464 | | |
1465 | | static PyObject * |
1466 | | _asyncio_Task_get_coro(PyObject *self, PyObject *Py_UNUSED(ignored)) |
1467 | 0 | { |
1468 | 0 | PyObject *return_value = NULL; |
1469 | |
|
1470 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
1471 | 0 | return_value = _asyncio_Task_get_coro_impl((TaskObj *)self); |
1472 | 0 | Py_END_CRITICAL_SECTION(); |
1473 | |
|
1474 | 0 | return return_value; |
1475 | 0 | } |
1476 | | |
1477 | | PyDoc_STRVAR(_asyncio_Task_get_context__doc__, |
1478 | | "get_context($self, /)\n" |
1479 | | "--\n" |
1480 | | "\n"); |
1481 | | |
1482 | | #define _ASYNCIO_TASK_GET_CONTEXT_METHODDEF \ |
1483 | | {"get_context", (PyCFunction)_asyncio_Task_get_context, METH_NOARGS, _asyncio_Task_get_context__doc__}, |
1484 | | |
1485 | | static PyObject * |
1486 | | _asyncio_Task_get_context_impl(TaskObj *self); |
1487 | | |
1488 | | static PyObject * |
1489 | | _asyncio_Task_get_context(PyObject *self, PyObject *Py_UNUSED(ignored)) |
1490 | 0 | { |
1491 | 0 | return _asyncio_Task_get_context_impl((TaskObj *)self); |
1492 | 0 | } |
1493 | | |
1494 | | PyDoc_STRVAR(_asyncio_Task_get_name__doc__, |
1495 | | "get_name($self, /)\n" |
1496 | | "--\n" |
1497 | | "\n"); |
1498 | | |
1499 | | #define _ASYNCIO_TASK_GET_NAME_METHODDEF \ |
1500 | | {"get_name", (PyCFunction)_asyncio_Task_get_name, METH_NOARGS, _asyncio_Task_get_name__doc__}, |
1501 | | |
1502 | | static PyObject * |
1503 | | _asyncio_Task_get_name_impl(TaskObj *self); |
1504 | | |
1505 | | static PyObject * |
1506 | | _asyncio_Task_get_name(PyObject *self, PyObject *Py_UNUSED(ignored)) |
1507 | 0 | { |
1508 | 0 | PyObject *return_value = NULL; |
1509 | |
|
1510 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
1511 | 0 | return_value = _asyncio_Task_get_name_impl((TaskObj *)self); |
1512 | 0 | Py_END_CRITICAL_SECTION(); |
1513 | |
|
1514 | 0 | return return_value; |
1515 | 0 | } |
1516 | | |
1517 | | PyDoc_STRVAR(_asyncio_Task_set_name__doc__, |
1518 | | "set_name($self, value, /)\n" |
1519 | | "--\n" |
1520 | | "\n"); |
1521 | | |
1522 | | #define _ASYNCIO_TASK_SET_NAME_METHODDEF \ |
1523 | | {"set_name", (PyCFunction)_asyncio_Task_set_name, METH_O, _asyncio_Task_set_name__doc__}, |
1524 | | |
1525 | | static PyObject * |
1526 | | _asyncio_Task_set_name_impl(TaskObj *self, PyObject *value); |
1527 | | |
1528 | | static PyObject * |
1529 | | _asyncio_Task_set_name(PyObject *self, PyObject *value) |
1530 | 0 | { |
1531 | 0 | PyObject *return_value = NULL; |
1532 | |
|
1533 | 0 | Py_BEGIN_CRITICAL_SECTION(self); |
1534 | 0 | return_value = _asyncio_Task_set_name_impl((TaskObj *)self, value); |
1535 | 0 | Py_END_CRITICAL_SECTION(); |
1536 | |
|
1537 | 0 | return return_value; |
1538 | 0 | } |
1539 | | |
1540 | | PyDoc_STRVAR(_asyncio__get_running_loop__doc__, |
1541 | | "_get_running_loop($module, /)\n" |
1542 | | "--\n" |
1543 | | "\n" |
1544 | | "Return the running event loop or None.\n" |
1545 | | "\n" |
1546 | | "This is a low-level function intended to be used by event loops.\n" |
1547 | | "This function is thread-specific."); |
1548 | | |
1549 | | #define _ASYNCIO__GET_RUNNING_LOOP_METHODDEF \ |
1550 | | {"_get_running_loop", (PyCFunction)_asyncio__get_running_loop, METH_NOARGS, _asyncio__get_running_loop__doc__}, |
1551 | | |
1552 | | static PyObject * |
1553 | | _asyncio__get_running_loop_impl(PyObject *module); |
1554 | | |
1555 | | static PyObject * |
1556 | | _asyncio__get_running_loop(PyObject *module, PyObject *Py_UNUSED(ignored)) |
1557 | 0 | { |
1558 | 0 | return _asyncio__get_running_loop_impl(module); |
1559 | 0 | } |
1560 | | |
1561 | | PyDoc_STRVAR(_asyncio__set_running_loop__doc__, |
1562 | | "_set_running_loop($module, loop, /)\n" |
1563 | | "--\n" |
1564 | | "\n" |
1565 | | "Set the running event loop.\n" |
1566 | | "\n" |
1567 | | "This is a low-level function intended to be used by event loops.\n" |
1568 | | "This function is thread-specific."); |
1569 | | |
1570 | | #define _ASYNCIO__SET_RUNNING_LOOP_METHODDEF \ |
1571 | | {"_set_running_loop", (PyCFunction)_asyncio__set_running_loop, METH_O, _asyncio__set_running_loop__doc__}, |
1572 | | |
1573 | | PyDoc_STRVAR(_asyncio_get_event_loop__doc__, |
1574 | | "get_event_loop($module, /)\n" |
1575 | | "--\n" |
1576 | | "\n" |
1577 | | "Return an asyncio event loop.\n" |
1578 | | "\n" |
1579 | | "When called from a coroutine or a callback (e.g. scheduled with\n" |
1580 | | "call_soon or similar API), this function will always return the\n" |
1581 | | "running event loop.\n" |
1582 | | "\n" |
1583 | | "If there is no running event loop set, the function will return\n" |
1584 | | "the result of `get_event_loop_policy().get_event_loop()` call."); |
1585 | | |
1586 | | #define _ASYNCIO_GET_EVENT_LOOP_METHODDEF \ |
1587 | | {"get_event_loop", (PyCFunction)_asyncio_get_event_loop, METH_NOARGS, _asyncio_get_event_loop__doc__}, |
1588 | | |
1589 | | static PyObject * |
1590 | | _asyncio_get_event_loop_impl(PyObject *module); |
1591 | | |
1592 | | static PyObject * |
1593 | | _asyncio_get_event_loop(PyObject *module, PyObject *Py_UNUSED(ignored)) |
1594 | 0 | { |
1595 | 0 | return _asyncio_get_event_loop_impl(module); |
1596 | 0 | } |
1597 | | |
1598 | | PyDoc_STRVAR(_asyncio_get_running_loop__doc__, |
1599 | | "get_running_loop($module, /)\n" |
1600 | | "--\n" |
1601 | | "\n" |
1602 | | "Return the running event loop. Raise a RuntimeError if there is none.\n" |
1603 | | "\n" |
1604 | | "This function is thread-specific."); |
1605 | | |
1606 | | #define _ASYNCIO_GET_RUNNING_LOOP_METHODDEF \ |
1607 | | {"get_running_loop", (PyCFunction)_asyncio_get_running_loop, METH_NOARGS, _asyncio_get_running_loop__doc__}, |
1608 | | |
1609 | | static PyObject * |
1610 | | _asyncio_get_running_loop_impl(PyObject *module); |
1611 | | |
1612 | | static PyObject * |
1613 | | _asyncio_get_running_loop(PyObject *module, PyObject *Py_UNUSED(ignored)) |
1614 | 0 | { |
1615 | 0 | return _asyncio_get_running_loop_impl(module); |
1616 | 0 | } |
1617 | | |
1618 | | PyDoc_STRVAR(_asyncio__register_task__doc__, |
1619 | | "_register_task($module, /, task)\n" |
1620 | | "--\n" |
1621 | | "\n" |
1622 | | "Register a new task in asyncio as executed by loop.\n" |
1623 | | "\n" |
1624 | | "Returns None."); |
1625 | | |
1626 | | #define _ASYNCIO__REGISTER_TASK_METHODDEF \ |
1627 | | {"_register_task", _PyCFunction_CAST(_asyncio__register_task), METH_FASTCALL|METH_KEYWORDS, _asyncio__register_task__doc__}, |
1628 | | |
1629 | | static PyObject * |
1630 | | _asyncio__register_task_impl(PyObject *module, PyObject *task); |
1631 | | |
1632 | | static PyObject * |
1633 | | _asyncio__register_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
1634 | 0 | { |
1635 | 0 | PyObject *return_value = NULL; |
1636 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
1637 | |
|
1638 | 0 | #define NUM_KEYWORDS 1 |
1639 | 0 | static struct { |
1640 | 0 | PyGC_Head _this_is_not_used; |
1641 | 0 | PyObject_VAR_HEAD |
1642 | 0 | Py_hash_t ob_hash; |
1643 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
1644 | 0 | } _kwtuple = { |
1645 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
1646 | 0 | .ob_hash = -1, |
1647 | 0 | .ob_item = { &_Py_ID(task), }, |
1648 | 0 | }; |
1649 | 0 | #undef NUM_KEYWORDS |
1650 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
1651 | |
|
1652 | | #else // !Py_BUILD_CORE |
1653 | | # define KWTUPLE NULL |
1654 | | #endif // !Py_BUILD_CORE |
1655 | |
|
1656 | 0 | static const char * const _keywords[] = {"task", NULL}; |
1657 | 0 | static _PyArg_Parser _parser = { |
1658 | 0 | .keywords = _keywords, |
1659 | 0 | .fname = "_register_task", |
1660 | 0 | .kwtuple = KWTUPLE, |
1661 | 0 | }; |
1662 | 0 | #undef KWTUPLE |
1663 | 0 | PyObject *argsbuf[1]; |
1664 | 0 | PyObject *task; |
1665 | |
|
1666 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
1667 | 0 | /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
1668 | 0 | if (!args) { |
1669 | 0 | goto exit; |
1670 | 0 | } |
1671 | 0 | task = args[0]; |
1672 | 0 | return_value = _asyncio__register_task_impl(module, task); |
1673 | |
|
1674 | 0 | exit: |
1675 | 0 | return return_value; |
1676 | 0 | } |
1677 | | |
1678 | | PyDoc_STRVAR(_asyncio__register_eager_task__doc__, |
1679 | | "_register_eager_task($module, /, task)\n" |
1680 | | "--\n" |
1681 | | "\n" |
1682 | | "Register a new task in asyncio as executed by loop.\n" |
1683 | | "\n" |
1684 | | "Returns None."); |
1685 | | |
1686 | | #define _ASYNCIO__REGISTER_EAGER_TASK_METHODDEF \ |
1687 | | {"_register_eager_task", _PyCFunction_CAST(_asyncio__register_eager_task), METH_FASTCALL|METH_KEYWORDS, _asyncio__register_eager_task__doc__}, |
1688 | | |
1689 | | static PyObject * |
1690 | | _asyncio__register_eager_task_impl(PyObject *module, PyObject *task); |
1691 | | |
1692 | | static PyObject * |
1693 | | _asyncio__register_eager_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
1694 | 0 | { |
1695 | 0 | PyObject *return_value = NULL; |
1696 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
1697 | |
|
1698 | 0 | #define NUM_KEYWORDS 1 |
1699 | 0 | static struct { |
1700 | 0 | PyGC_Head _this_is_not_used; |
1701 | 0 | PyObject_VAR_HEAD |
1702 | 0 | Py_hash_t ob_hash; |
1703 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
1704 | 0 | } _kwtuple = { |
1705 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
1706 | 0 | .ob_hash = -1, |
1707 | 0 | .ob_item = { &_Py_ID(task), }, |
1708 | 0 | }; |
1709 | 0 | #undef NUM_KEYWORDS |
1710 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
1711 | |
|
1712 | | #else // !Py_BUILD_CORE |
1713 | | # define KWTUPLE NULL |
1714 | | #endif // !Py_BUILD_CORE |
1715 | |
|
1716 | 0 | static const char * const _keywords[] = {"task", NULL}; |
1717 | 0 | static _PyArg_Parser _parser = { |
1718 | 0 | .keywords = _keywords, |
1719 | 0 | .fname = "_register_eager_task", |
1720 | 0 | .kwtuple = KWTUPLE, |
1721 | 0 | }; |
1722 | 0 | #undef KWTUPLE |
1723 | 0 | PyObject *argsbuf[1]; |
1724 | 0 | PyObject *task; |
1725 | |
|
1726 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
1727 | 0 | /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
1728 | 0 | if (!args) { |
1729 | 0 | goto exit; |
1730 | 0 | } |
1731 | 0 | task = args[0]; |
1732 | 0 | return_value = _asyncio__register_eager_task_impl(module, task); |
1733 | |
|
1734 | 0 | exit: |
1735 | 0 | return return_value; |
1736 | 0 | } |
1737 | | |
1738 | | PyDoc_STRVAR(_asyncio__unregister_task__doc__, |
1739 | | "_unregister_task($module, /, task)\n" |
1740 | | "--\n" |
1741 | | "\n" |
1742 | | "Unregister a task.\n" |
1743 | | "\n" |
1744 | | "Returns None."); |
1745 | | |
1746 | | #define _ASYNCIO__UNREGISTER_TASK_METHODDEF \ |
1747 | | {"_unregister_task", _PyCFunction_CAST(_asyncio__unregister_task), METH_FASTCALL|METH_KEYWORDS, _asyncio__unregister_task__doc__}, |
1748 | | |
1749 | | static PyObject * |
1750 | | _asyncio__unregister_task_impl(PyObject *module, PyObject *task); |
1751 | | |
1752 | | static PyObject * |
1753 | | _asyncio__unregister_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
1754 | 0 | { |
1755 | 0 | PyObject *return_value = NULL; |
1756 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
1757 | |
|
1758 | 0 | #define NUM_KEYWORDS 1 |
1759 | 0 | static struct { |
1760 | 0 | PyGC_Head _this_is_not_used; |
1761 | 0 | PyObject_VAR_HEAD |
1762 | 0 | Py_hash_t ob_hash; |
1763 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
1764 | 0 | } _kwtuple = { |
1765 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
1766 | 0 | .ob_hash = -1, |
1767 | 0 | .ob_item = { &_Py_ID(task), }, |
1768 | 0 | }; |
1769 | 0 | #undef NUM_KEYWORDS |
1770 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
1771 | |
|
1772 | | #else // !Py_BUILD_CORE |
1773 | | # define KWTUPLE NULL |
1774 | | #endif // !Py_BUILD_CORE |
1775 | |
|
1776 | 0 | static const char * const _keywords[] = {"task", NULL}; |
1777 | 0 | static _PyArg_Parser _parser = { |
1778 | 0 | .keywords = _keywords, |
1779 | 0 | .fname = "_unregister_task", |
1780 | 0 | .kwtuple = KWTUPLE, |
1781 | 0 | }; |
1782 | 0 | #undef KWTUPLE |
1783 | 0 | PyObject *argsbuf[1]; |
1784 | 0 | PyObject *task; |
1785 | |
|
1786 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
1787 | 0 | /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
1788 | 0 | if (!args) { |
1789 | 0 | goto exit; |
1790 | 0 | } |
1791 | 0 | task = args[0]; |
1792 | 0 | return_value = _asyncio__unregister_task_impl(module, task); |
1793 | |
|
1794 | 0 | exit: |
1795 | 0 | return return_value; |
1796 | 0 | } |
1797 | | |
1798 | | PyDoc_STRVAR(_asyncio__unregister_eager_task__doc__, |
1799 | | "_unregister_eager_task($module, /, task)\n" |
1800 | | "--\n" |
1801 | | "\n" |
1802 | | "Unregister a task.\n" |
1803 | | "\n" |
1804 | | "Returns None."); |
1805 | | |
1806 | | #define _ASYNCIO__UNREGISTER_EAGER_TASK_METHODDEF \ |
1807 | | {"_unregister_eager_task", _PyCFunction_CAST(_asyncio__unregister_eager_task), METH_FASTCALL|METH_KEYWORDS, _asyncio__unregister_eager_task__doc__}, |
1808 | | |
1809 | | static PyObject * |
1810 | | _asyncio__unregister_eager_task_impl(PyObject *module, PyObject *task); |
1811 | | |
1812 | | static PyObject * |
1813 | | _asyncio__unregister_eager_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
1814 | 0 | { |
1815 | 0 | PyObject *return_value = NULL; |
1816 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
1817 | |
|
1818 | 0 | #define NUM_KEYWORDS 1 |
1819 | 0 | static struct { |
1820 | 0 | PyGC_Head _this_is_not_used; |
1821 | 0 | PyObject_VAR_HEAD |
1822 | 0 | Py_hash_t ob_hash; |
1823 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
1824 | 0 | } _kwtuple = { |
1825 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
1826 | 0 | .ob_hash = -1, |
1827 | 0 | .ob_item = { &_Py_ID(task), }, |
1828 | 0 | }; |
1829 | 0 | #undef NUM_KEYWORDS |
1830 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
1831 | |
|
1832 | | #else // !Py_BUILD_CORE |
1833 | | # define KWTUPLE NULL |
1834 | | #endif // !Py_BUILD_CORE |
1835 | |
|
1836 | 0 | static const char * const _keywords[] = {"task", NULL}; |
1837 | 0 | static _PyArg_Parser _parser = { |
1838 | 0 | .keywords = _keywords, |
1839 | 0 | .fname = "_unregister_eager_task", |
1840 | 0 | .kwtuple = KWTUPLE, |
1841 | 0 | }; |
1842 | 0 | #undef KWTUPLE |
1843 | 0 | PyObject *argsbuf[1]; |
1844 | 0 | PyObject *task; |
1845 | |
|
1846 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
1847 | 0 | /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
1848 | 0 | if (!args) { |
1849 | 0 | goto exit; |
1850 | 0 | } |
1851 | 0 | task = args[0]; |
1852 | 0 | return_value = _asyncio__unregister_eager_task_impl(module, task); |
1853 | |
|
1854 | 0 | exit: |
1855 | 0 | return return_value; |
1856 | 0 | } |
1857 | | |
1858 | | PyDoc_STRVAR(_asyncio__enter_task__doc__, |
1859 | | "_enter_task($module, /, loop, task)\n" |
1860 | | "--\n" |
1861 | | "\n" |
1862 | | "Enter into task execution or resume suspended task.\n" |
1863 | | "\n" |
1864 | | "Task belongs to loop.\n" |
1865 | | "\n" |
1866 | | "Returns None."); |
1867 | | |
1868 | | #define _ASYNCIO__ENTER_TASK_METHODDEF \ |
1869 | | {"_enter_task", _PyCFunction_CAST(_asyncio__enter_task), METH_FASTCALL|METH_KEYWORDS, _asyncio__enter_task__doc__}, |
1870 | | |
1871 | | static PyObject * |
1872 | | _asyncio__enter_task_impl(PyObject *module, PyObject *loop, PyObject *task); |
1873 | | |
1874 | | static PyObject * |
1875 | | _asyncio__enter_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
1876 | 0 | { |
1877 | 0 | PyObject *return_value = NULL; |
1878 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
1879 | |
|
1880 | 0 | #define NUM_KEYWORDS 2 |
1881 | 0 | static struct { |
1882 | 0 | PyGC_Head _this_is_not_used; |
1883 | 0 | PyObject_VAR_HEAD |
1884 | 0 | Py_hash_t ob_hash; |
1885 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
1886 | 0 | } _kwtuple = { |
1887 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
1888 | 0 | .ob_hash = -1, |
1889 | 0 | .ob_item = { &_Py_ID(loop), &_Py_ID(task), }, |
1890 | 0 | }; |
1891 | 0 | #undef NUM_KEYWORDS |
1892 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
1893 | |
|
1894 | | #else // !Py_BUILD_CORE |
1895 | | # define KWTUPLE NULL |
1896 | | #endif // !Py_BUILD_CORE |
1897 | |
|
1898 | 0 | static const char * const _keywords[] = {"loop", "task", NULL}; |
1899 | 0 | static _PyArg_Parser _parser = { |
1900 | 0 | .keywords = _keywords, |
1901 | 0 | .fname = "_enter_task", |
1902 | 0 | .kwtuple = KWTUPLE, |
1903 | 0 | }; |
1904 | 0 | #undef KWTUPLE |
1905 | 0 | PyObject *argsbuf[2]; |
1906 | 0 | PyObject *loop; |
1907 | 0 | PyObject *task; |
1908 | |
|
1909 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
1910 | 0 | /*minpos*/ 2, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
1911 | 0 | if (!args) { |
1912 | 0 | goto exit; |
1913 | 0 | } |
1914 | 0 | loop = args[0]; |
1915 | 0 | task = args[1]; |
1916 | 0 | return_value = _asyncio__enter_task_impl(module, loop, task); |
1917 | |
|
1918 | 0 | exit: |
1919 | 0 | return return_value; |
1920 | 0 | } |
1921 | | |
1922 | | PyDoc_STRVAR(_asyncio__leave_task__doc__, |
1923 | | "_leave_task($module, /, loop, task)\n" |
1924 | | "--\n" |
1925 | | "\n" |
1926 | | "Leave task execution or suspend a task.\n" |
1927 | | "\n" |
1928 | | "Task belongs to loop.\n" |
1929 | | "\n" |
1930 | | "Returns None."); |
1931 | | |
1932 | | #define _ASYNCIO__LEAVE_TASK_METHODDEF \ |
1933 | | {"_leave_task", _PyCFunction_CAST(_asyncio__leave_task), METH_FASTCALL|METH_KEYWORDS, _asyncio__leave_task__doc__}, |
1934 | | |
1935 | | static PyObject * |
1936 | | _asyncio__leave_task_impl(PyObject *module, PyObject *loop, PyObject *task); |
1937 | | |
1938 | | static PyObject * |
1939 | | _asyncio__leave_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
1940 | 0 | { |
1941 | 0 | PyObject *return_value = NULL; |
1942 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
1943 | |
|
1944 | 0 | #define NUM_KEYWORDS 2 |
1945 | 0 | static struct { |
1946 | 0 | PyGC_Head _this_is_not_used; |
1947 | 0 | PyObject_VAR_HEAD |
1948 | 0 | Py_hash_t ob_hash; |
1949 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
1950 | 0 | } _kwtuple = { |
1951 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
1952 | 0 | .ob_hash = -1, |
1953 | 0 | .ob_item = { &_Py_ID(loop), &_Py_ID(task), }, |
1954 | 0 | }; |
1955 | 0 | #undef NUM_KEYWORDS |
1956 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
1957 | |
|
1958 | | #else // !Py_BUILD_CORE |
1959 | | # define KWTUPLE NULL |
1960 | | #endif // !Py_BUILD_CORE |
1961 | |
|
1962 | 0 | static const char * const _keywords[] = {"loop", "task", NULL}; |
1963 | 0 | static _PyArg_Parser _parser = { |
1964 | 0 | .keywords = _keywords, |
1965 | 0 | .fname = "_leave_task", |
1966 | 0 | .kwtuple = KWTUPLE, |
1967 | 0 | }; |
1968 | 0 | #undef KWTUPLE |
1969 | 0 | PyObject *argsbuf[2]; |
1970 | 0 | PyObject *loop; |
1971 | 0 | PyObject *task; |
1972 | |
|
1973 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
1974 | 0 | /*minpos*/ 2, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
1975 | 0 | if (!args) { |
1976 | 0 | goto exit; |
1977 | 0 | } |
1978 | 0 | loop = args[0]; |
1979 | 0 | task = args[1]; |
1980 | 0 | return_value = _asyncio__leave_task_impl(module, loop, task); |
1981 | |
|
1982 | 0 | exit: |
1983 | 0 | return return_value; |
1984 | 0 | } |
1985 | | |
1986 | | PyDoc_STRVAR(_asyncio__swap_current_task__doc__, |
1987 | | "_swap_current_task($module, /, loop, task)\n" |
1988 | | "--\n" |
1989 | | "\n" |
1990 | | "Temporarily swap in the supplied task and return the original one (or None).\n" |
1991 | | "\n" |
1992 | | "This is intended for use during eager coroutine execution."); |
1993 | | |
1994 | | #define _ASYNCIO__SWAP_CURRENT_TASK_METHODDEF \ |
1995 | | {"_swap_current_task", _PyCFunction_CAST(_asyncio__swap_current_task), METH_FASTCALL|METH_KEYWORDS, _asyncio__swap_current_task__doc__}, |
1996 | | |
1997 | | static PyObject * |
1998 | | _asyncio__swap_current_task_impl(PyObject *module, PyObject *loop, |
1999 | | PyObject *task); |
2000 | | |
2001 | | static PyObject * |
2002 | | _asyncio__swap_current_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
2003 | 0 | { |
2004 | 0 | PyObject *return_value = NULL; |
2005 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
2006 | |
|
2007 | 0 | #define NUM_KEYWORDS 2 |
2008 | 0 | static struct { |
2009 | 0 | PyGC_Head _this_is_not_used; |
2010 | 0 | PyObject_VAR_HEAD |
2011 | 0 | Py_hash_t ob_hash; |
2012 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
2013 | 0 | } _kwtuple = { |
2014 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
2015 | 0 | .ob_hash = -1, |
2016 | 0 | .ob_item = { &_Py_ID(loop), &_Py_ID(task), }, |
2017 | 0 | }; |
2018 | 0 | #undef NUM_KEYWORDS |
2019 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
2020 | |
|
2021 | | #else // !Py_BUILD_CORE |
2022 | | # define KWTUPLE NULL |
2023 | | #endif // !Py_BUILD_CORE |
2024 | |
|
2025 | 0 | static const char * const _keywords[] = {"loop", "task", NULL}; |
2026 | 0 | static _PyArg_Parser _parser = { |
2027 | 0 | .keywords = _keywords, |
2028 | 0 | .fname = "_swap_current_task", |
2029 | 0 | .kwtuple = KWTUPLE, |
2030 | 0 | }; |
2031 | 0 | #undef KWTUPLE |
2032 | 0 | PyObject *argsbuf[2]; |
2033 | 0 | PyObject *loop; |
2034 | 0 | PyObject *task; |
2035 | |
|
2036 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
2037 | 0 | /*minpos*/ 2, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
2038 | 0 | if (!args) { |
2039 | 0 | goto exit; |
2040 | 0 | } |
2041 | 0 | loop = args[0]; |
2042 | 0 | task = args[1]; |
2043 | 0 | return_value = _asyncio__swap_current_task_impl(module, loop, task); |
2044 | |
|
2045 | 0 | exit: |
2046 | 0 | return return_value; |
2047 | 0 | } |
2048 | | |
2049 | | PyDoc_STRVAR(_asyncio_current_task__doc__, |
2050 | | "current_task($module, /, loop=None)\n" |
2051 | | "--\n" |
2052 | | "\n" |
2053 | | "Return a currently executed task."); |
2054 | | |
2055 | | #define _ASYNCIO_CURRENT_TASK_METHODDEF \ |
2056 | | {"current_task", _PyCFunction_CAST(_asyncio_current_task), METH_FASTCALL|METH_KEYWORDS, _asyncio_current_task__doc__}, |
2057 | | |
2058 | | static PyObject * |
2059 | | _asyncio_current_task_impl(PyObject *module, PyObject *loop); |
2060 | | |
2061 | | static PyObject * |
2062 | | _asyncio_current_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
2063 | 0 | { |
2064 | 0 | PyObject *return_value = NULL; |
2065 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
2066 | |
|
2067 | 0 | #define NUM_KEYWORDS 1 |
2068 | 0 | static struct { |
2069 | 0 | PyGC_Head _this_is_not_used; |
2070 | 0 | PyObject_VAR_HEAD |
2071 | 0 | Py_hash_t ob_hash; |
2072 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
2073 | 0 | } _kwtuple = { |
2074 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
2075 | 0 | .ob_hash = -1, |
2076 | 0 | .ob_item = { &_Py_ID(loop), }, |
2077 | 0 | }; |
2078 | 0 | #undef NUM_KEYWORDS |
2079 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
2080 | |
|
2081 | | #else // !Py_BUILD_CORE |
2082 | | # define KWTUPLE NULL |
2083 | | #endif // !Py_BUILD_CORE |
2084 | |
|
2085 | 0 | static const char * const _keywords[] = {"loop", NULL}; |
2086 | 0 | static _PyArg_Parser _parser = { |
2087 | 0 | .keywords = _keywords, |
2088 | 0 | .fname = "current_task", |
2089 | 0 | .kwtuple = KWTUPLE, |
2090 | 0 | }; |
2091 | 0 | #undef KWTUPLE |
2092 | 0 | PyObject *argsbuf[1]; |
2093 | 0 | Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
2094 | 0 | PyObject *loop = Py_None; |
2095 | |
|
2096 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
2097 | 0 | /*minpos*/ 0, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
2098 | 0 | if (!args) { |
2099 | 0 | goto exit; |
2100 | 0 | } |
2101 | 0 | if (!noptargs) { |
2102 | 0 | goto skip_optional_pos; |
2103 | 0 | } |
2104 | 0 | loop = args[0]; |
2105 | 0 | skip_optional_pos: |
2106 | 0 | return_value = _asyncio_current_task_impl(module, loop); |
2107 | |
|
2108 | 0 | exit: |
2109 | 0 | return return_value; |
2110 | 0 | } |
2111 | | |
2112 | | PyDoc_STRVAR(_asyncio_all_tasks__doc__, |
2113 | | "all_tasks($module, /, loop=None)\n" |
2114 | | "--\n" |
2115 | | "\n" |
2116 | | "Return a set of all tasks for the loop."); |
2117 | | |
2118 | | #define _ASYNCIO_ALL_TASKS_METHODDEF \ |
2119 | | {"all_tasks", _PyCFunction_CAST(_asyncio_all_tasks), METH_FASTCALL|METH_KEYWORDS, _asyncio_all_tasks__doc__}, |
2120 | | |
2121 | | static PyObject * |
2122 | | _asyncio_all_tasks_impl(PyObject *module, PyObject *loop); |
2123 | | |
2124 | | static PyObject * |
2125 | | _asyncio_all_tasks(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
2126 | 0 | { |
2127 | 0 | PyObject *return_value = NULL; |
2128 | 0 | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
2129 | |
|
2130 | 0 | #define NUM_KEYWORDS 1 |
2131 | 0 | static struct { |
2132 | 0 | PyGC_Head _this_is_not_used; |
2133 | 0 | PyObject_VAR_HEAD |
2134 | 0 | Py_hash_t ob_hash; |
2135 | 0 | PyObject *ob_item[NUM_KEYWORDS]; |
2136 | 0 | } _kwtuple = { |
2137 | 0 | .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
2138 | 0 | .ob_hash = -1, |
2139 | 0 | .ob_item = { &_Py_ID(loop), }, |
2140 | 0 | }; |
2141 | 0 | #undef NUM_KEYWORDS |
2142 | 0 | #define KWTUPLE (&_kwtuple.ob_base.ob_base) |
2143 | |
|
2144 | | #else // !Py_BUILD_CORE |
2145 | | # define KWTUPLE NULL |
2146 | | #endif // !Py_BUILD_CORE |
2147 | |
|
2148 | 0 | static const char * const _keywords[] = {"loop", NULL}; |
2149 | 0 | static _PyArg_Parser _parser = { |
2150 | 0 | .keywords = _keywords, |
2151 | 0 | .fname = "all_tasks", |
2152 | 0 | .kwtuple = KWTUPLE, |
2153 | 0 | }; |
2154 | 0 | #undef KWTUPLE |
2155 | 0 | PyObject *argsbuf[1]; |
2156 | 0 | Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; |
2157 | 0 | PyObject *loop = Py_None; |
2158 | |
|
2159 | 0 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
2160 | 0 | /*minpos*/ 0, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
2161 | 0 | if (!args) { |
2162 | 0 | goto exit; |
2163 | 0 | } |
2164 | 0 | if (!noptargs) { |
2165 | 0 | goto skip_optional_pos; |
2166 | 0 | } |
2167 | 0 | loop = args[0]; |
2168 | 0 | skip_optional_pos: |
2169 | 0 | return_value = _asyncio_all_tasks_impl(module, loop); |
2170 | |
|
2171 | 0 | exit: |
2172 | 0 | return return_value; |
2173 | 0 | } |
2174 | | |
2175 | | PyDoc_STRVAR(_asyncio_future_add_to_awaited_by__doc__, |
2176 | | "future_add_to_awaited_by($module, fut, waiter, /)\n" |
2177 | | "--\n" |
2178 | | "\n" |
2179 | | "Record that `fut` is awaited on by `waiter`."); |
2180 | | |
2181 | | #define _ASYNCIO_FUTURE_ADD_TO_AWAITED_BY_METHODDEF \ |
2182 | | {"future_add_to_awaited_by", _PyCFunction_CAST(_asyncio_future_add_to_awaited_by), METH_FASTCALL, _asyncio_future_add_to_awaited_by__doc__}, |
2183 | | |
2184 | | static PyObject * |
2185 | | _asyncio_future_add_to_awaited_by_impl(PyObject *module, PyObject *fut, |
2186 | | PyObject *waiter); |
2187 | | |
2188 | | static PyObject * |
2189 | | _asyncio_future_add_to_awaited_by(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
2190 | 0 | { |
2191 | 0 | PyObject *return_value = NULL; |
2192 | 0 | PyObject *fut; |
2193 | 0 | PyObject *waiter; |
2194 | |
|
2195 | 0 | if (!_PyArg_CheckPositional("future_add_to_awaited_by", nargs, 2, 2)) { |
2196 | 0 | goto exit; |
2197 | 0 | } |
2198 | 0 | fut = args[0]; |
2199 | 0 | waiter = args[1]; |
2200 | 0 | return_value = _asyncio_future_add_to_awaited_by_impl(module, fut, waiter); |
2201 | |
|
2202 | 0 | exit: |
2203 | 0 | return return_value; |
2204 | 0 | } |
2205 | | |
2206 | | PyDoc_STRVAR(_asyncio_future_discard_from_awaited_by__doc__, |
2207 | | "future_discard_from_awaited_by($module, fut, waiter, /)\n" |
2208 | | "--\n" |
2209 | | "\n"); |
2210 | | |
2211 | | #define _ASYNCIO_FUTURE_DISCARD_FROM_AWAITED_BY_METHODDEF \ |
2212 | | {"future_discard_from_awaited_by", _PyCFunction_CAST(_asyncio_future_discard_from_awaited_by), METH_FASTCALL, _asyncio_future_discard_from_awaited_by__doc__}, |
2213 | | |
2214 | | static PyObject * |
2215 | | _asyncio_future_discard_from_awaited_by_impl(PyObject *module, PyObject *fut, |
2216 | | PyObject *waiter); |
2217 | | |
2218 | | static PyObject * |
2219 | | _asyncio_future_discard_from_awaited_by(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
2220 | 0 | { |
2221 | 0 | PyObject *return_value = NULL; |
2222 | 0 | PyObject *fut; |
2223 | 0 | PyObject *waiter; |
2224 | |
|
2225 | 0 | if (!_PyArg_CheckPositional("future_discard_from_awaited_by", nargs, 2, 2)) { |
2226 | 0 | goto exit; |
2227 | 0 | } |
2228 | 0 | fut = args[0]; |
2229 | 0 | waiter = args[1]; |
2230 | 0 | return_value = _asyncio_future_discard_from_awaited_by_impl(module, fut, waiter); |
2231 | |
|
2232 | 0 | exit: |
2233 | 0 | return return_value; |
2234 | 0 | } |
2235 | | /*[clinic end generated code: output=b69948ed810591d9 input=a9049054013a1b77]*/ |