Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(6)

Unified Diff: Objects/rangeobject.c

Issue 28376: assertion failure in rangeobject.c
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_range.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Objects/rangeobject.c Sat Oct 08 16:15:15 2016 +0300
+++ b/Objects/rangeobject.c Sat Oct 08 20:08:29 2016 +0300
@@ -930,12 +930,27 @@
{
long start, stop, step;
- if (!_PyArg_NoKeywords("rangeiter()", kw))
+ if (PyErr_WarnEx(PyExc_DeprecationWarning,
+ "range_iterator(): creating instances of range_iterator "
+ "by calling range_iterator type is deprecated",
+ 1)) {
return NULL;
+ }
- if (!PyArg_ParseTuple(args, "lll;rangeiter() requires 3 int arguments",
- &start, &stop, &step))
+ if (!_PyArg_NoKeywords("range_iterator()", kw)) {
return NULL;
+ }
+
+ 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);
}
« no previous file with comments | « Lib/test/test_range.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+