mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
listreverse(): Don't call the new reverse_slice unless the list
has something in it (else ob_item may be a NULL pointer).
This commit is contained in:
parent
a8c974c157
commit
326b44871e
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue