Skip to content

Commit

Permalink
fix possible crash in asyncio
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 committed Sep 19, 2024
1 parent 7331d0f commit c429deb
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,14 +434,7 @@ future_schedule_callbacks(asyncio_state *state, FutureObj *fut)
return 0;
}

len = PyList_GET_SIZE(fut->fut_callbacks);
if (len == 0) {
/* The list of callbacks was empty; clear it and return. */
Py_CLEAR(fut->fut_callbacks);
return 0;
}

for (i = 0; i < len; i++) {
for (i = 0; i < PyList_GET_SIZE(fut->fut_callbacks); i++) {
PyObject *cb_tup = PyList_GET_ITEM(fut->fut_callbacks, i);
PyObject *cb = PyTuple_GET_ITEM(cb_tup, 0);
PyObject *ctx = PyTuple_GET_ITEM(cb_tup, 1);
Expand Down

0 comments on commit c429deb

Please sign in to comment.