Commit 0913166d authored by Raymond Hettinger's avatar Raymond Hettinger

Remove unnecessary modulo division.

The preceding test guarantees that 0 <= i < len.
parent 01612e7d
...@@ -98,7 +98,7 @@ range_item(rangeobject *r, Py_ssize_t i) ...@@ -98,7 +98,7 @@ range_item(rangeobject *r, Py_ssize_t i)
"xrange object index out of range"); "xrange object index out of range");
return NULL; return NULL;
} }
return PyInt_FromSsize_t(r->start + (i % r->len) * r->step); return PyInt_FromSsize_t(r->start + i * r->step);
} }
static Py_ssize_t static Py_ssize_t
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment