Inverted test for small speedup
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 8e8f77e..26050c1 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -116,11 +116,10 @@
static PyObject *
range_next(rangeobject *r)
{
- if (r->index >= r->len) {
- PyErr_SetObject(PyExc_StopIteration, Py_None);
- return NULL;
- }
- return PyInt_FromLong(r->start + (r->index++) * r->step);
+ if (r->index < r->len)
+ return PyInt_FromLong(r->start + (r->index++) * r->step);
+ PyErr_SetObject(PyExc_StopIteration, Py_None);
+ return NULL;
}
static PyMethodDef range_methods[] = {