Skip to content

Commit

Permalink
pythongh-111789: Use PyDict_GetItemRef() in Modules/_asynciomodule.c
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka committed Nov 14, 2023
1 parent 0ff6368 commit 61e103f
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 61e103f

Please sign in to comment.