summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@gmail.com>2017-03-03 03:16:33 (GMT)
committerGitHub <noreply@github.com>2017-03-03 03:16:33 (GMT)
commit8d26aa930c0123933a1ceb12fceba4f5aef4e95e (patch)
tree451f0306af10c7536354524f1792944bf12067c4 /Modules
parentba7e1f9a4e06c0b4ad594fd64edcaf7292515820 (diff)
downloadcpython-8d26aa930c0123933a1ceb12fceba4f5aef4e95e.zip
cpython-8d26aa930c0123933a1ceb12fceba4f5aef4e95e.tar.gz
cpython-8d26aa930c0123933a1ceb12fceba4f5aef4e95e.tar.bz2
bpo-29271: Fix Task.current_task and Task.all_tasks to accept None. (#406)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_asynciomodule.c12
-rw-r--r--Modules/clinic/_asynciomodule.c.h6
2 files changed, 9 insertions, 9 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index ceac7f0..2204792 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -1414,7 +1414,7 @@ TaskObj_get_fut_waiter(TaskObj *task)
@classmethod
_asyncio.Task.current_task
- loop: 'O' = NULL
+ loop: 'O' = None
Return the currently running task in an event loop or None.
@@ -1425,11 +1425,11 @@ None is returned when called not in the context of a Task.
static PyObject *
_asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop)
-/*[clinic end generated code: output=99fbe7332c516e03 input=cd784537f02cf833]*/
+/*[clinic end generated code: output=99fbe7332c516e03 input=a0d6cdf2e3b243e1]*/
{
PyObject *res;
- if (loop == NULL) {
+ if (loop == Py_None) {
loop = _PyObject_CallNoArg(asyncio_get_event_loop);
if (loop == NULL) {
return NULL;
@@ -1501,7 +1501,7 @@ fail:
@classmethod
_asyncio.Task.all_tasks
- loop: 'O' = NULL
+ loop: 'O' = None
Return a set of all tasks for an event loop.
@@ -1510,11 +1510,11 @@ By default all tasks for the current event loop are returned.
static PyObject *
_asyncio_Task_all_tasks_impl(PyTypeObject *type, PyObject *loop)
-/*[clinic end generated code: output=11f9b20749ccca5d input=cd64aa5f88bd5c49]*/
+/*[clinic end generated code: output=11f9b20749ccca5d input=c6f5b53bd487488f]*/
{
PyObject *res;
- if (loop == NULL) {
+ if (loop == Py_None) {
loop = _PyObject_CallNoArg(asyncio_get_event_loop);
if (loop == NULL) {
return NULL;
diff --git a/Modules/clinic/_asynciomodule.c.h b/Modules/clinic/_asynciomodule.c.h
index f3204fb..94a6f8d 100644
--- a/Modules/clinic/_asynciomodule.c.h
+++ b/Modules/clinic/_asynciomodule.c.h
@@ -278,7 +278,7 @@ _asyncio_Task_current_task(PyTypeObject *type, PyObject **args, Py_ssize_t nargs
PyObject *return_value = NULL;
static const char * const _keywords[] = {"loop", NULL};
static _PyArg_Parser _parser = {"|O:current_task", _keywords, 0};
- PyObject *loop = NULL;
+ PyObject *loop = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&loop)) {
@@ -310,7 +310,7 @@ _asyncio_Task_all_tasks(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, P
PyObject *return_value = NULL;
static const char * const _keywords[] = {"loop", NULL};
static _PyArg_Parser _parser = {"|O:all_tasks", _keywords, 0};
- PyObject *loop = NULL;
+ PyObject *loop = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&loop)) {
@@ -517,4 +517,4 @@ _asyncio_Task__wakeup(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject
exit:
return return_value;
}
-/*[clinic end generated code: output=07a15bbb28d03edc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3dfec49689cebd4c input=a9049054013a1b77]*/