Mailing List Archive

gh-95808: Add missing early returns in _asynciomodule.c (#95809)
https://github.com/python/cpython/commit/b2afe482f21b826d53886a69ea2c99d0d940c59a
commit: b2afe482f21b826d53886a69ea2c99d0d940c59a
branch: main
author: Yury Selivanov <yury@edgedb.com>
committer: 1st1 <yury@edgedb.com>
date: 2022-08-15T16:32:40-07:00
summary:

gh-95808: Add missing early returns in _asynciomodule.c (#95809)

files:
M Modules/_asynciomodule.c

diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index f94819cad24..9d2f83bf6c7 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);
}

_______________________________________________
Python-checkins mailing list
Python-checkins@python.org
https://mail.python.org/mailman/listinfo/python-checkins