From a02683ac38183fa3a45c32319dfd329c5e622f0e Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Wed, 24 Mar 2021 01:42:13 +0000 Subject: bpo-31861: Fix reference leak in builtin_anext_impl() (GH-25008) --- Python/bltinmodule.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index d08e9a3..a076006 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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; } -- cgit v0.12