mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue 6305: Clarify error message for large arguments to itertools.islice().
This commit is contained in:
parent
df45cda0dd
commit
ec7bfb314c
1 changed files with 3 additions and 3 deletions
|
@ -1137,7 +1137,7 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"Stop argument for islice() must be a non-negative integer or None.");
|
"Stop argument for islice() must be None or an integer: 0 <= x <= maxsize.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1152,14 +1152,14 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"Stop argument for islice() must be a non-negative integer or None.");
|
"Stop argument for islice() must be None or an integer: 0 <= x <= maxsize.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (start<0 || stop<-1) {
|
if (start<0 || stop<-1) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"Indices for islice() must be non-negative integers or None.");
|
"Indices for islice() must be None or an integer: 0 <= x <= maxsize.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue