Skip to content

Commit

Permalink
pythongh-95808: Add missing early returns in _asynciomodule.c
Browse files Browse the repository at this point in the history
  • Loading branch information
1st1 committed Aug 9, 2022
1 parent 8a55e2f commit 8500be6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,9 @@ create_cancelled_error(FutureObj *fut)
} else {
exc = PyObject_CallOneArg(asyncio_CancelledError, msg);
}
if (exc == NULL) {
return NULL;
}
PyException_SetContext(exc, fut->fut_cancelled_exc);
Py_CLEAR(fut->fut_cancelled_exc);
return exc;
Expand All @@ -640,6 +643,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);
}
Expand Down

0 comments on commit 8500be6

Please sign in to comment.