summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2021-03-24 01:42:13 (GMT)
committerGitHub <noreply@github.com>2021-03-24 01:42:13 (GMT)
commita02683ac38183fa3a45c32319dfd329c5e622f0e (patch)
treee69586260419b20d7ea13037e58dcccc9dec1b2d
parent8370e07e1e5b626e78ddc7aadbfaf248976c4454 (diff)
downloadcpython-a02683ac38183fa3a45c32319dfd329c5e622f0e.zip
cpython-a02683ac38183fa3a45c32319dfd329c5e622f0e.tar.gz
cpython-a02683ac38183fa3a45c32319dfd329c5e622f0e.tar.bz2
bpo-31861: Fix reference leak in builtin_anext_impl() (GH-25008)
-rw-r--r--Python/bltinmodule.c5
1 files changed, 4 insertions, 1 deletions
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;
}