diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2023-11-15 04:28:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-15 04:28:30 (GMT) |
commit | d4f83e1e3a19e2f881115f20d58ae6a019ddb48f (patch) | |
tree | 08ce85308608998dc7ec647b2272cdac78d53f43 /Modules/_asynciomodule.c | |
parent | 6c214dea7c503eb42bd130d43e8880f39bff0350 (diff) | |
download | cpython-d4f83e1e3a19e2f881115f20d58ae6a019ddb48f.zip cpython-d4f83e1e3a19e2f881115f20d58ae6a019ddb48f.tar.gz cpython-d4f83e1e3a19e2f881115f20d58ae6a019ddb48f.tar.bz2 |
gh-111789: Use PyDict_GetItemRef() in Modules/_asynciomodule.c (GH-112072)
Diffstat (limited to 'Modules/_asynciomodule.c')
-rw-r--r-- | Modules/_asynciomodule.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 6d06208..3a11cdc 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -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; } |