diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-08 18:45:07 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-08 18:45:07 (GMT) |
commit | 639098c5911b88f03972e7fd44fe230a651cbc9b (patch) | |
tree | 0d07b6b556969e0d25582dfeaa46294f9a4d32be /Objects/rangeobject.c | |
parent | 88212ae10a779cfae0b81db42b5b71aaf2227915 (diff) | |
parent | 44759bcf13d6b47323fd4c6e4d62b7146ed0a5b1 (diff) | |
download | cpython-639098c5911b88f03972e7fd44fe230a651cbc9b.zip cpython-639098c5911b88f03972e7fd44fe230a651cbc9b.tar.gz cpython-639098c5911b88f03972e7fd44fe230a651cbc9b.tar.bz2 |
Merge from 3.5.
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 e7c3709..eb18611 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -930,12 +930,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); } |