Skip to content

Commit d4f83e1

Browse files
gh-111789: Use PyDict_GetItemRef() in Modules/_asynciomodule.c (GH-112072)
1 parent 6c214de commit d4f83e1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Modules/_asynciomodule.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3514,15 +3514,11 @@ _asyncio_current_task_impl(PyObject *module, PyObject *loop)
35143514
Py_INCREF(loop);
35153515
}
35163516

3517-
ret = PyDict_GetItemWithError(state->current_tasks, loop);
3517+
int rc = PyDict_GetItemRef(state->current_tasks, loop, &ret);
35183518
Py_DECREF(loop);
3519-
if (ret == NULL && PyErr_Occurred()) {
3520-
return NULL;
3521-
}
3522-
else if (ret == NULL) {
3519+
if (rc == 0) {
35233520
Py_RETURN_NONE;
35243521
}
3525-
Py_INCREF(ret);
35263522
return ret;
35273523
}
35283524

0 commit comments

Comments
 (0)