Mercurial > cpython-lru_cache-weakref
diff Objects/rangeobject.c @ 56210:0f4e95ff859d
Issue #1766304: The range.__contains__ optimization should only be
applied to ints, not to instances of subclasses of int.
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Thu, 24 Sep 2009 20:04:23 +0000 |
| parents | d599a3f2e72d |
| children | 370d218a01bc |
line wrap: on
line diff
--- a/Objects/rangeobject.c Thu Sep 24 19:24:44 2009 +0000 +++ b/Objects/rangeobject.c Thu Sep 24 20:04:23 2009 +0000 @@ -275,7 +275,7 @@ static int range_contains(rangeobject *r, PyObject *ob) { - if (PyLong_Check(ob)) { + if (PyLong_CheckExact(ob) || PyBool_Check(ob)) { int cmp1, cmp2, cmp3; PyObject *tmp1 = NULL; PyObject *tmp2 = NULL;
