diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-07-19 04:04:16 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-07-19 04:04:16 (GMT) |
commit | 326b44871eb9dcf98e286208bf2b2799edf2ba9e (patch) | |
tree | b77518c1641f9557e073aa9690eadb4b566aab7f /Objects/listobject.c | |
parent | a8c974c157c8f4e2b0c16b9be638db54748aa12b (diff) | |
download | cpython-326b44871eb9dcf98e286208bf2b2799edf2ba9e.zip cpython-326b44871eb9dcf98e286208bf2b2799edf2ba9e.tar.gz cpython-326b44871eb9dcf98e286208bf2b2799edf2ba9e.tar.bz2 |
listreverse(): Don't call the new reverse_slice unless the list
has something in it (else ob_item may be a NULL pointer).
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index f2132b4..ce0f22e 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -1316,7 +1316,8 @@ PyList_Sort(PyObject *v) static PyObject * listreverse(PyListObject *self) { - reverse_slice(self->ob_item, self->ob_item + self->ob_size); + if (self->ob_size > 1) + reverse_slice(self->ob_item, self->ob_item + self->ob_size); Py_INCREF(Py_None); return Py_None; } |