[issue21321] itertools.islice() doesn't release reference to the source iterator when the slice is exhausted

Antoine Pitrou report at bugs.python.org
Tue Apr 29 10:39:22 CEST 2014


Antoine Pitrou added the comment:

Thanks. Could you also add a test for the islice_reduce additions? Or is it already tested?
I suspect there's a reference leak there: after calling PyObject_GetIter, you should always Py_DECREF(empty_list).
Also, with the "O" code, Py_BuildValue will take a new reference to empty_it, so you should use the "N" code instead.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21321>
_______________________________________


More information about the Python-bugs-list mailing list