Skip to content

Commit

Permalink
pythongh-95808: Add missing early returns in _asynciomodule.c (python…
Browse files Browse the repository at this point in the history
…GH-95809)

(cherry picked from commit b2afe48)

Co-authored-by: Yury Selivanov <[email protected]>
  • Loading branch information
miss-islington and 1st1 authored Aug 16, 2022
1 parent d55a775 commit af3e491
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,15 +631,16 @@ 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;
}

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 af3e491

Please sign in to comment.