mirror of
https://github.com/python/cpython.git
synced 2025-08-25 11:15:02 +00:00
bpo-44110: Improve string's __getitem__ error message (GH-26042)
This commit is contained in:
parent
7569c0fe91
commit
ed1076428c
4 changed files with 13 additions and 3 deletions
|
@ -14279,7 +14279,8 @@ unicode_subscript(PyObject* self, PyObject* item)
|
|||
assert(_PyUnicode_CheckConsistency(result, 1));
|
||||
return result;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError, "string indices must be integers");
|
||||
PyErr_Format(PyExc_TypeError, "string indices must be integers, not '%.200s'",
|
||||
Py_TYPE(item)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue