diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-30 17:48:54 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-30 17:48:54 +0300 |
commit | e90982111ae1accc2a2ecaae94650a1d16a772ff (patch) | |
tree | 960c19c6de6a13c3aa3f1388ffe2898c112c61d0 /Objects/rangeobject.c | |
parent | f49c42324fb85596bcfaaba236ecd6e22138be72 (diff) | |
parent | ac5569b1fa483c50edca82bab1ab0a8a927ba86a (diff) | |
download | cpython-git-e90982111ae1accc2a2ecaae94650a1d16a772ff.tar.gz |
Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
Diffstat (limited to 'Objects/rangeobject.c')
-rw-r--r-- | Objects/rangeobject.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 17fef42c6a..da1d703b3a 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -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); } |