From: Fred Drake Date: Wed, 8 Nov 2000 18:37:05 +0000 (+0000) Subject: In the containment test, get the boundary condition right. ">" was used X-Git-Tag: v2.1a1~756 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a91e1650aafd63e7940a1c838aa1377981ad459c;p=python In the containment test, get the boundary condition right. ">" was used where ">=" should have been. This closes bug #121965. --- diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 5c794fc204..0deabe90cb 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -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; }