From f5816da131f87180c29010beaa1e918594006fd1 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Mon, 14 Mar 2022 03:16:45 +0200 Subject: [PATCH] Fix C Task impl --- Modules/_asynciomodule.c | 6 +++--- Modules/clinic/_asynciomodule.c.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 3625c8c3e51104..4b12744e625e19 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -2003,7 +2003,7 @@ _asyncio.Task.__init__ * loop: object = None name: object = None - context: object(c_default='NULL') = None + context: object = None A coroutine wrapped in a Future. [clinic start generated code]*/ @@ -2011,7 +2011,7 @@ A coroutine wrapped in a Future. static int _asyncio_Task___init___impl(TaskObj *self, PyObject *coro, PyObject *loop, PyObject *name, PyObject *context) -/*[clinic end generated code: output=49ac96fe33d0e5c7 input=f45c94aefa9c235a]*/ +/*[clinic end generated code: output=49ac96fe33d0e5c7 input=924522490c8ce825]*/ { if (future_init((FutureObj*)self, loop)) { @@ -2030,7 +2030,7 @@ _asyncio_Task___init___impl(TaskObj *self, PyObject *coro, PyObject *loop, return -1; } - if (context == NULL) { + if (context == Py_None) { Py_XSETREF(self->task_context, PyContext_CopyCurrent()); if (self->task_context == NULL) { return -1; diff --git a/Modules/clinic/_asynciomodule.c.h b/Modules/clinic/_asynciomodule.c.h index ee65960dbb8577..4a90dfa67c22b2 100644 --- a/Modules/clinic/_asynciomodule.c.h +++ b/Modules/clinic/_asynciomodule.c.h @@ -332,7 +332,7 @@ _asyncio_Task___init__(PyObject *self, PyObject *args, PyObject *kwargs) PyObject *coro; PyObject *loop = Py_None; PyObject *name = Py_None; - PyObject *context = NULL; + PyObject *context = Py_None; fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf); if (!fastargs) { @@ -924,4 +924,4 @@ _asyncio__leave_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs, exit: return return_value; } -/*[clinic end generated code: output=69ee4650645d4fd3 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=540ed3caf5a4d57d input=a9049054013a1b77]*/