Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b2afe48

Browse files
authored
gh-95808: Add missing early returns in _asynciomodule.c (#95809)
1 parent f6b8110 commit b2afe48

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Modules/_asynciomodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,15 +631,16 @@ create_cancelled_error(FutureObj *fut)
631631
} else {
632632
exc = PyObject_CallOneArg(asyncio_CancelledError, msg);
633633
}
634-
PyException_SetContext(exc, fut->fut_cancelled_exc);
635-
Py_CLEAR(fut->fut_cancelled_exc);
636634
return exc;
637635
}
638636

639637
static void
640638
future_set_cancelled_error(FutureObj *fut)
641639
{
642640
PyObject *exc = create_cancelled_error(fut);
641+
if (exc == NULL) {
642+
return;
643+
}
643644
PyErr_SetObject(asyncio_CancelledError, exc);
644645
Py_DECREF(exc);
645646
}

0 commit comments

Comments
 (0)