summaryrefslogtreecommitdiffstats
path: root/Modules/_asynciomodule.c
diff options
context:
space:
mode:
authorYury Selivanov <yury@edgedb.com>2022-08-15 23:32:40 (GMT)
committerGitHub <noreply@github.com>2022-08-15 23:32:40 (GMT)
commitb2afe482f21b826d53886a69ea2c99d0d940c59a (patch)
tree9e25903acda0048998e6b83e811f80839e428ca4 /Modules/_asynciomodule.c
parentf6b811059ac945a283bb59bf37efac162c3bbab6 (diff)
downloadcpython-b2afe482f21b826d53886a69ea2c99d0d940c59a.zip
cpython-b2afe482f21b826d53886a69ea2c99d0d940c59a.tar.gz
cpython-b2afe482f21b826d53886a69ea2c99d0d940c59a.tar.bz2
gh-95808: Add missing early returns in _asynciomodule.c (#95809)
Diffstat (limited to 'Modules/_asynciomodule.c')
-rw-r--r--Modules/_asynciomodule.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index f94819c..9d2f83b 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -631,8 +631,6 @@ create_cancelled_error(FutureObj *fut)
} else {
exc = PyObject_CallOneArg(asyncio_CancelledError, msg);
}
- PyException_SetContext(exc, fut->fut_cancelled_exc);
- Py_CLEAR(fut->fut_cancelled_exc);
return exc;
}
@@ -640,6 +638,9 @@ static void
future_set_cancelled_error(FutureObj *fut)
{
PyObject *exc = create_cancelled_error(fut);
+ if (exc == NULL) {
+ return;
+ }
PyErr_SetObject(asyncio_CancelledError, exc);
Py_DECREF(exc);
}