diff options
author | Yury Selivanov <yury@magic.io> | 2017-12-23 20:04:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-23 20:04:15 (GMT) |
commit | ca9b36cd1a384e5ecb56d9df9a59144240353ef0 (patch) | |
tree | 3efb5c02ae40b61eb5c6391d3144d0f2f26cd616 /Modules/clinic | |
parent | 558aa30f7971e087c4a00b1f49cc2ef3195c01ca (diff) | |
download | cpython-ca9b36cd1a384e5ecb56d9df9a59144240353ef0.zip cpython-ca9b36cd1a384e5ecb56d9df9a59144240353ef0.tar.gz cpython-ca9b36cd1a384e5ecb56d9df9a59144240353ef0.tar.bz2 |
bpo-32415: Add asyncio.Task.get_loop() and Future.get_loop() (#4992)
Diffstat (limited to 'Modules/clinic')
-rw-r--r-- | Modules/clinic/_asynciomodule.c.h | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/Modules/clinic/_asynciomodule.c.h b/Modules/clinic/_asynciomodule.c.h index 9d5dea5..6a35434 100644 --- a/Modules/clinic/_asynciomodule.c.h +++ b/Modules/clinic/_asynciomodule.c.h @@ -194,6 +194,24 @@ _asyncio_Future_done(FutureObj *self, PyObject *Py_UNUSED(ignored)) return _asyncio_Future_done_impl(self); } +PyDoc_STRVAR(_asyncio_Future_get_loop__doc__, +"get_loop($self, /)\n" +"--\n" +"\n" +"Return the event loop the Future is bound to."); + +#define _ASYNCIO_FUTURE_GET_LOOP_METHODDEF \ + {"get_loop", (PyCFunction)_asyncio_Future_get_loop, METH_NOARGS, _asyncio_Future_get_loop__doc__}, + +static PyObject * +_asyncio_Future_get_loop_impl(FutureObj *self); + +static PyObject * +_asyncio_Future_get_loop(FutureObj *self, PyObject *Py_UNUSED(ignored)) +{ + return _asyncio_Future_get_loop_impl(self); +} + PyDoc_STRVAR(_asyncio_Future__repr_info__doc__, "_repr_info($self, /)\n" "--\n" @@ -597,7 +615,7 @@ _asyncio_get_running_loop(PyObject *module, PyObject *Py_UNUSED(ignored)) } PyDoc_STRVAR(_asyncio__register_task__doc__, -"_register_task($module, /, loop, task)\n" +"_register_task($module, /, task)\n" "--\n" "\n" "Register a new task in asyncio as executed by loop.\n" @@ -608,30 +626,28 @@ PyDoc_STRVAR(_asyncio__register_task__doc__, {"_register_task", (PyCFunction)_asyncio__register_task, METH_FASTCALL|METH_KEYWORDS, _asyncio__register_task__doc__}, static PyObject * -_asyncio__register_task_impl(PyObject *module, PyObject *loop, - PyObject *task); +_asyncio__register_task_impl(PyObject *module, PyObject *task); static PyObject * _asyncio__register_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"loop", "task", NULL}; - static _PyArg_Parser _parser = {"OO:_register_task", _keywords, 0}; - PyObject *loop; + static const char * const _keywords[] = {"task", NULL}; + static _PyArg_Parser _parser = {"O:_register_task", _keywords, 0}; PyObject *task; if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, - &loop, &task)) { + &task)) { goto exit; } - return_value = _asyncio__register_task_impl(module, loop, task); + return_value = _asyncio__register_task_impl(module, task); exit: return return_value; } PyDoc_STRVAR(_asyncio__unregister_task__doc__, -"_unregister_task($module, /, loop, task)\n" +"_unregister_task($module, /, task)\n" "--\n" "\n" "Unregister a task.\n" @@ -642,23 +658,21 @@ PyDoc_STRVAR(_asyncio__unregister_task__doc__, {"_unregister_task", (PyCFunction)_asyncio__unregister_task, METH_FASTCALL|METH_KEYWORDS, _asyncio__unregister_task__doc__}, static PyObject * -_asyncio__unregister_task_impl(PyObject *module, PyObject *loop, - PyObject *task); +_asyncio__unregister_task_impl(PyObject *module, PyObject *task); static PyObject * _asyncio__unregister_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"loop", "task", NULL}; - static _PyArg_Parser _parser = {"OO:_unregister_task", _keywords, 0}; - PyObject *loop; + static const char * const _keywords[] = {"task", NULL}; + static _PyArg_Parser _parser = {"O:_unregister_task", _keywords, 0}; PyObject *task; if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, - &loop, &task)) { + &task)) { goto exit; } - return_value = _asyncio__unregister_task_impl(module, loop, task); + return_value = _asyncio__unregister_task_impl(module, task); exit: return return_value; @@ -733,4 +747,4 @@ _asyncio__leave_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, exit: return return_value; } -/*[clinic end generated code: output=0033af17965b51b4 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5d100b3d74f2a0f4 input=a9049054013a1b77]*/ |