Minor code cleanups.

This commit is contained in:
Raymond Hettinger 2015-05-11 19:25:32 -07:00
parent 21ee10bf04
commit 99bf9a2567
1 changed files with 5 additions and 5 deletions

View File

@ -138,7 +138,7 @@ heappop_internal(PyObject *heap, int siftup_func(PyListObject *, Py_ssize_t))
lastelt = PyList_GET_ITEM(heap, n-1) ; lastelt = PyList_GET_ITEM(heap, n-1) ;
Py_INCREF(lastelt); Py_INCREF(lastelt);
if (PyList_SetSlice(heap, n-1, n, NULL) < 0) { if (PyList_SetSlice(heap, n-1, n, NULL)) {
Py_DECREF(lastelt); Py_DECREF(lastelt);
return NULL; return NULL;
} }
@ -177,7 +177,7 @@ heapreplace_internal(PyObject *args, int siftup_func(PyListObject *, Py_ssize_t)
return NULL; return NULL;
} }
if (PyList_GET_SIZE(heap) < 1) { if (PyList_GET_SIZE(heap) == 0) {
PyErr_SetString(PyExc_IndexError, "index out of range"); PyErr_SetString(PyExc_IndexError, "index out of range");
return NULL; return NULL;
} }
@ -222,7 +222,7 @@ heappushpop(PyObject *self, PyObject *args)
return NULL; return NULL;
} }
if (PyList_GET_SIZE(heap) < 1) { if (PyList_GET_SIZE(heap) == 0) {
Py_INCREF(item); Py_INCREF(item);
return item; return item;
} }