mirror of
https://github.com/python/cpython.git
synced 2025-11-20 02:50:14 +00:00
Make the error message for unsupported operand types cleaner, in
response to a message by Laura Creighton on c.l.py. E.g.
>>> 0+''
TypeError: unsupported operand types for +: 'int' and 'str'
(previously this did not mention the operand types)
>>> ''+0
TypeError: cannot concatenate 'str' and 'int' objects
This commit is contained in:
parent
279e744573
commit
5c66a26dee
2 changed files with 28 additions and 8 deletions
|
|
@ -691,7 +691,7 @@ string_concat(register PyStringObject *a, register PyObject *bb)
|
|||
return PyUnicode_Concat((PyObject *)a, bb);
|
||||
#endif
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"cannot add type \"%.200s\" to string",
|
||||
"cannot concatenate 'str' and '%.200s' objects",
|
||||
bb->ob_type->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue