mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Add error handling in range_count.
This commit is contained in:
parent
0b458d52f9
commit
7e5343b882
1 changed files with 4 additions and 1 deletions
|
@ -337,7 +337,10 @@ static PyObject *
|
|||
range_count(rangeobject *r, PyObject *ob)
|
||||
{
|
||||
if (PyLong_CheckExact(ob) || PyBool_Check(ob)) {
|
||||
if (range_contains_long(r, ob))
|
||||
int result = range_contains_long(r, ob);
|
||||
if (result == -1)
|
||||
return NULL;
|
||||
else if (result)
|
||||
return PyLong_FromLong(1);
|
||||
else
|
||||
return PyLong_FromLong(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue