Skip to content

Commit ec7bfb3

Browse files
committed
Issue 6305: Clarify error message for large arguments to itertools.islice().
1 parent df45cda commit ec7bfb3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Modules/itertoolsmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
11371137
if (PyErr_Occurred())
11381138
PyErr_Clear();
11391139
PyErr_SetString(PyExc_ValueError,
1140-
"Stop argument for islice() must be a non-negative integer or None.");
1140+
"Stop argument for islice() must be None or an integer: 0 <= x <= maxsize.");
11411141
return NULL;
11421142
}
11431143
}
@@ -1152,14 +1152,14 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
11521152
if (PyErr_Occurred())
11531153
PyErr_Clear();
11541154
PyErr_SetString(PyExc_ValueError,
1155-
"Stop argument for islice() must be a non-negative integer or None.");
1155+
"Stop argument for islice() must be None or an integer: 0 <= x <= maxsize.");
11561156
return NULL;
11571157
}
11581158
}
11591159
}
11601160
if (start<0 || stop<-1) {
11611161
PyErr_SetString(PyExc_ValueError,
1162-
"Indices for islice() must be non-negative integers or None.");
1162+
"Indices for islice() must be None or an integer: 0 <= x <= maxsize.");
11631163
return NULL;
11641164
}
11651165

0 commit comments

Comments
 (0)