summaryrefslogtreecommitdiffstats
path: root/Objects/rangeobject.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-09-24 20:04:23 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-09-24 20:04:23 (GMT)
commit418f81d9b65ca2c7942ff9c422ad01d5050a808f (patch)
treea2e1fabc0af6fad77c1142badf29227c0f9bdd43 /Objects/rangeobject.c
parent067b38eed41bc659ab3d3f9d780a824ed5d1b857 (diff)
downloadcpython-418f81d9b65ca2c7942ff9c422ad01d5050a808f.zip
cpython-418f81d9b65ca2c7942ff9c422ad01d5050a808f.tar.gz
cpython-418f81d9b65ca2c7942ff9c422ad01d5050a808f.tar.bz2
Issue #1766304: The range.__contains__ optimization should only be
applied to ints, not to instances of subclasses of int.
Diffstat (limited to 'Objects/rangeobject.c')
-rw-r--r--Objects/rangeobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 213f3dd..beff030 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -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;