summaryrefslogtreecommitdiffstats
path: root/Modules/_asynciomodule.c
diff options
context:
space:
mode:
authorAlex Grönholm <alex.gronholm@nextday.fi>2019-05-30 15:30:09 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-05-30 15:30:09 (GMT)
commit98ef92002ec289bf8086b0ef3d4f96c2589f4e68 (patch)
tree0c3420f69cef6e0c306af7508fdd06415b39a853 /Modules/_asynciomodule.c
parent25ee0c3bf10820496448e2886069f9c2794be7ac (diff)
downloadcpython-98ef92002ec289bf8086b0ef3d4f96c2589f4e68.zip
cpython-98ef92002ec289bf8086b0ef3d4f96c2589f4e68.tar.gz
cpython-98ef92002ec289bf8086b0ef3d4f96c2589f4e68.tar.bz2
bpo-36999: Add asyncio.Task.get_coro() (GH-13680)
https://bugs.python.org/issue36999
Diffstat (limited to 'Modules/_asynciomodule.c')
-rw-r--r--Modules/_asynciomodule.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index d8b631b..281161b 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -2314,6 +2314,18 @@ _asyncio_Task_set_exception(TaskObj *self, PyObject *exception)
}
/*[clinic input]
+_asyncio.Task.get_coro
+[clinic start generated code]*/
+
+static PyObject *
+_asyncio_Task_get_coro_impl(TaskObj *self)
+/*[clinic end generated code: output=bcac27c8cc6c8073 input=d2e8606c42a7b403]*/
+{
+ Py_INCREF(self->task_coro);
+ return self->task_coro;
+}
+
+/*[clinic input]
_asyncio.Task.get_name
[clinic start generated code]*/
@@ -2439,6 +2451,7 @@ static PyMethodDef TaskType_methods[] = {
_ASYNCIO_TASK__REPR_INFO_METHODDEF
_ASYNCIO_TASK_GET_NAME_METHODDEF
_ASYNCIO_TASK_SET_NAME_METHODDEF
+ _ASYNCIO_TASK_GET_CORO_METHODDEF
{NULL, NULL} /* Sentinel */
};