gh-111789: Use PyDict_GetItemRef() in Modules/_asynciomodule.c (GH-112072)

This commit is contained in:
Serhiy Storchaka 2023-11-15 06:28:30 +02:00 committed by GitHub
parent 6c214dea7c
commit d4f83e1e3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -3514,15 +3514,11 @@ _asyncio_current_task_impl(PyObject *module, PyObject *loop)
Py_INCREF(loop); Py_INCREF(loop);
} }
ret = PyDict_GetItemWithError(state->current_tasks, loop); int rc = PyDict_GetItemRef(state->current_tasks, loop, &ret);
Py_DECREF(loop); Py_DECREF(loop);
if (ret == NULL && PyErr_Occurred()) { if (rc == 0) {
return NULL;
}
else if (ret == NULL) {
Py_RETURN_NONE; Py_RETURN_NONE;
} }
Py_INCREF(ret);
return ret; return ret;
} }