count() should return integers #10474

This commit is contained in:
Benjamin Peterson 2010-11-20 22:35:41 +00:00
parent 2e579f0a87
commit 0b458d52f9
3 changed files with 6 additions and 2 deletions

View file

@ -338,9 +338,9 @@ range_count(rangeobject *r, PyObject *ob)
{
if (PyLong_CheckExact(ob) || PyBool_Check(ob)) {
if (range_contains_long(r, ob))
Py_RETURN_TRUE;
return PyLong_FromLong(1);
else
Py_RETURN_FALSE;
return PyLong_FromLong(0);
} else {
Py_ssize_t count;
count = _PySequence_IterSearch((PyObject*)r, ob, PY_ITERSEARCH_COUNT);