Skip to content

Commit

Permalink
pythongh-111789: Use PyDict_GetItemRef() in Modules/_asynciomodule.c (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka authored Nov 15, 2023
1 parent 6c214de commit d4f83e1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3514,15 +3514,11 @@ _asyncio_current_task_impl(PyObject *module, PyObject *loop)
Py_INCREF(loop);
}

ret = PyDict_GetItemWithError(state->current_tasks, loop);
int rc = PyDict_GetItemRef(state->current_tasks, loop, &ret);
Py_DECREF(loop);
if (ret == NULL && PyErr_Occurred()) {
return NULL;
}
else if (ret == NULL) {
if (rc == 0) {
Py_RETURN_NONE;
}
Py_INCREF(ret);
return ret;
}

Expand Down

0 comments on commit d4f83e1

Please sign in to comment.