Issue #1766304: The range.__contains__ optimization should only be

applied to ints, not to instances of subclasses of int.
This commit is contained in:
Mark Dickinson 2009-09-24 20:04:23 +00:00
parent 067b38eed4
commit 418f81d9b6
2 changed files with 7 additions and 1 deletions

View file

@ -275,7 +275,7 @@ range_reduce(rangeobject *r, PyObject *args)
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;