[Python-checkins] bpo-31861: Fix reference leak in builtin_anext_impl() (GH-25008)

pablogsal webhook-mailer at python.org
Tue Mar 23 21:42:30 EDT 2021


https://github.com/python/cpython/commit/a02683ac38183fa3a45c32319dfd329c5e622f0e
commit: a02683ac38183fa3a45c32319dfd329c5e622f0e
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: pablogsal <Pablogsal at gmail.com>
date: 2021-03-24T01:42:13Z
summary:

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

files:
M Python/bltinmodule.c

diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index d08e9a332670a..a076006d65231 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;
 }
 
 



More information about the Python-checkins mailing list