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

This commit is contained in:
Yury Selivanov 2022-08-15 16:32:40 -07:00 committed by GitHub
parent f6b811059a
commit b2afe482f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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);
}