Skip to content

Commit 6063e26

Browse files
committed
PyList_Reverse(): This was leaking a reference to Py_None on every call.
I believe I introduced this bug when I refactored the reversal code so that the mergesort could use it too. It's not a problem on the 2.2 branch.
1 parent 443fec3 commit 6063e26

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Objects/listobject.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1718,11 +1718,14 @@ listreverse(PyListObject *self)
17181718
int
17191719
PyList_Reverse(PyObject *v)
17201720
{
1721+
PyListObject *self = (PyListObject *)v;
1722+
17211723
if (v == NULL || !PyList_Check(v)) {
17221724
PyErr_BadInternalCall();
17231725
return -1;
17241726
}
1725-
listreverse((PyListObject *)v);
1727+
if (self->ob_size > 1)
1728+
reverse_slice(self->ob_item, self->ob_item + self->ob_size);
17261729
return 0;
17271730
}
17281731

0 commit comments

Comments
 (0)