From a91e1650aafd63e7940a1c838aa1377981ad459c Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Wed, 8 Nov 2000 18:37:05 +0000 Subject: [PATCH] In the containment test, get the boundary condition right. ">" was used where ">=" should have been. This closes bug #121965. --- Objects/rangeobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 5c794fc204f..0deabe90cbe 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; }