mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
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:
commit
ac5569b1fa
10 changed files with 92 additions and 40 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue