From bb9c5f5032fb3ab46760566d1129562f44c07e89 Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Thu, 5 Sep 2002 21:32:55 +0000 Subject: PyObject_RichCompareBool() already returns -1, 0, or 1, so return its value --- Objects/listobject.c | 6 +----- Objects/tupleobject.c | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Objects/listobject.c b/Objects/listobject.c index 229d64c..64de38b 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -325,11 +325,7 @@ list_contains(PyListObject *a, PyObject *el) for (i = 0, cmp = 0 ; cmp == 0 && i < a->ob_size; ++i) cmp = PyObject_RichCompareBool(el, PyList_GET_ITEM(a, i), Py_EQ); - if (cmp > 0) - return 1; - if (cmp < 0) - return -1; - return 0; + return cmp; } diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index a6b862f..6c2162a 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -266,11 +266,7 @@ tuplecontains(PyTupleObject *a, PyObject *el) for (i = 0, cmp = 0 ; cmp == 0 && i < a->ob_size; ++i) cmp = PyObject_RichCompareBool(el, PyTuple_GET_ITEM(a, i), Py_EQ); - if (cmp > 0) - return 1; - if (cmp < 0) - return -1; - return 0; + return cmp; } static PyObject * -- cgit v0.12