bpo-31861: Fix reference leak in builtin_anext_impl() (GH-25008)

This commit is contained in:
Pablo Galindo 2021-03-24 01:42:13 +00:00 committed by GitHub
parent 8370e07e1e
commit a02683ac38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1660,7 +1660,10 @@ builtin_anext_impl(PyObject *module, PyObject *aiterator,
return awaitable;
}
return PyAnextAwaitable_New(awaitable, default_value);
PyObject* new_awaitable = PyAnextAwaitable_New(
awaitable, default_value);
Py_DECREF(awaitable);
return new_awaitable;
}