Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),

PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
This commit is contained in:
Serhiy Storchaka 2015-05-30 17:45:22 +03:00
parent 50451eb912
commit fa494fd883
10 changed files with 83 additions and 36 deletions

View file

@ -194,8 +194,11 @@ compute_range_length(PyObject *start, PyObject *stop, PyObject *step)
}
/* if (lo >= hi), return length of 0. */
if (PyObject_RichCompareBool(lo, hi, Py_GE) == 1) {
cmp_result = PyObject_RichCompareBool(lo, hi, Py_GE);
if (cmp_result != 0) {
Py_XDECREF(step);
if (cmp_result < 0)
return NULL;
return PyLong_FromLong(0);
}