Commit 7e5343b8 authored by Georg Brandl's avatar Georg Brandl

Add error handling in range_count.

parent 0b458d52
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment