[Python-checkins] python/dist/src/Objects listobject.c,2.132,2.133
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Wed, 07 Aug 2002 18:06:41 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv9909/python/Objects
Modified Files:
listobject.c
Log Message:
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.
Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.132
retrieving revision 2.133
diff -C2 -d -r2.132 -r2.133
*** listobject.c 4 Aug 2002 17:47:26 -0000 2.132
--- listobject.c 8 Aug 2002 01:06:39 -0000 2.133
***************
*** 1719,1727 ****
PyList_Reverse(PyObject *v)
{
if (v == NULL || !PyList_Check(v)) {
PyErr_BadInternalCall();
return -1;
}
! listreverse((PyListObject *)v);
return 0;
}
--- 1719,1730 ----
PyList_Reverse(PyObject *v)
{
+ PyListObject *self = (PyListObject *)v;
+
if (v == NULL || !PyList_Check(v)) {
PyErr_BadInternalCall();
return -1;
}
! if (self->ob_size > 1)
! reverse_slice(self->ob_item, self->ob_item + self->ob_size);
return 0;
}