Skip to content

Commit a02683a

Browse files
authored
bpo-31861: Fix reference leak in builtin_anext_impl() (GH-25008)
1 parent 8370e07 commit a02683a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Python/bltinmodule.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1660,7 +1660,10 @@ builtin_anext_impl(PyObject *module, PyObject *aiterator,
16601660
return awaitable;
16611661
}
16621662

1663-
return PyAnextAwaitable_New(awaitable, default_value);
1663+
PyObject* new_awaitable = PyAnextAwaitable_New(
1664+
awaitable, default_value);
1665+
Py_DECREF(awaitable);
1666+
return new_awaitable;
16641667
}
16651668

16661669

0 commit comments

Comments
 (0)