summaryrefslogtreecommitdiffstats
path: root/Objects/rangeobject.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-11-08 18:37:05 (GMT)
committerFred Drake <fdrake@acm.org>2000-11-08 18:37:05 (GMT)
commita91e1650aafd63e7940a1c838aa1377981ad459c (patch)
treef444d243d3fcfbf49d4376c7e3870730444171b1 /Objects/rangeobject.c
parentf4e13a45639e906691690afa6281dba2103247a9 (diff)
downloadcpython-a91e1650aafd63e7940a1c838aa1377981ad459c.zip
cpython-a91e1650aafd63e7940a1c838aa1377981ad459c.tar.gz
cpython-a91e1650aafd63e7940a1c838aa1377981ad459c.tar.bz2
In the containment test, get the boundary condition right. ">" was used
where ">=" should have been. This closes bug #121965.
Diffstat (limited to 'Objects/rangeobject.c')
-rw-r--r--Objects/rangeobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 5c794fc..0deabe9 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;
}