mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #22077: Improve index error messages for bytearrays, bytes, lists, and
tuples by adding 'or slices'. Added ', not <typename' for bytearrays. Original patch by Claudiu Popa.
This commit is contained in:
parent
7f9cc9359b
commit
ffff1440d1
8 changed files with 45 additions and 6 deletions
|
@ -2444,7 +2444,7 @@ list_subscript(PyListObject* self, PyObject* item)
|
|||
}
|
||||
else {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"list indices must be integers, not %.200s",
|
||||
"list indices must be integers or slices, not %.200s",
|
||||
item->ob_type->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2608,7 +2608,7 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value)
|
|||
}
|
||||
else {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"list indices must be integers, not %.200s",
|
||||
"list indices must be integers or slices, not %.200s",
|
||||
item->ob_type->tp_name);
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue