mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
count() should return integers #10474
This commit is contained in:
parent
2e579f0a87
commit
0b458d52f9
3 changed files with 6 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue