]> granicus.if.org Git - python/commitdiff
In the containment test, get the boundary condition right. ">" was used
authorFred Drake <fdrake@acm.org>
Wed, 8 Nov 2000 18:37:05 +0000 (18:37 +0000)
committerFred Drake <fdrake@acm.org>
Wed, 8 Nov 2000 18:37:05 +0000 (18:37 +0000)
where ">=" should have been.

This closes bug #121965.

Objects/rangeobject.c

index 5c794fc204f42a940ee30fe274e6fa3d8984a6df..0deabe90cbe71339e9f16be7d198b259958eea2a 100644 (file)
@@ -193,9 +193,9 @@ range_contains(rangeobject *r, PyObject *obj)
        if (num < 0 && PyErr_Occurred())
                return -1;
 
-       if (num < r->start || (num - r->start) % r->step)
+       if ((num < r->start) || ((num - r->start) % r->step))
                return 0;
-       if (num > (r->start + (r->len * r->step)))
+       if (num >= (r->start + (r->len * r->step)))
                return 0;
        return 1;
 }