summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-08-08 01:06:39 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-08-08 01:06:39 (GMT)
commit6063e2615f4d8647e1808d0c94286e525085536f (patch)
treef5731d68b917c7044ce0b969910c895ffc8ba4d6
parent443fec3dd9c1a2c60b538af0504d4926e633b9b4 (diff)
downloadcpython-6063e2615f4d8647e1808d0c94286e525085536f.zip
cpython-6063e2615f4d8647e1808d0c94286e525085536f.tar.gz
cpython-6063e2615f4d8647e1808d0c94286e525085536f.tar.bz2
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.
-rw-r--r--Objects/listobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index e2b9b2b..7fad905 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -1718,11 +1718,14 @@ listreverse(PyListObject *self)
int
PyList_Reverse(PyObject *v)
{
+ PyListObject *self = (PyListObject *)v;
+
if (v == NULL || !PyList_Check(v)) {
PyErr_BadInternalCall();
return -1;
}
- listreverse((PyListObject *)v);
+ if (self->ob_size > 1)
+ reverse_slice(self->ob_item, self->ob_item + self->ob_size);
return 0;
}