Skip to content

Commit

Permalink
gh-95808: Add missing early returns in _asynciomodule.c (#95809)
Browse files Browse the repository at this point in the history
  • Loading branch information
1st1 authored Aug 15, 2022
1 parent f6b8110 commit b2afe48
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 b2afe48

Please sign in to comment.