diff options
Diffstat (limited to 'Objects/rangeobject.c')
-rw-r--r-- | Objects/rangeobject.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 288be4f..899697a 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -937,12 +937,20 @@ rangeiter_new(PyTypeObject *type, PyObject *args, PyObject *kw) { long start, stop, step; - if (!_PyArg_NoKeywords("rangeiter()", kw)) + if (!_PyArg_NoKeywords("range_iterator()", kw)) { return NULL; + } - if (!PyArg_ParseTuple(args, "lll;rangeiter() requires 3 int arguments", - &start, &stop, &step)) + if (!PyArg_ParseTuple(args, + "lll;range_iterator() requires 3 int arguments", + &start, &stop, &step)) { + return NULL; + } + if (step == 0) { + PyErr_SetString(PyExc_ValueError, + "range_iterator() arg 3 must not be zero"); return NULL; + } return fast_range_iter(start, stop, step); } |