Mercurial > cpython-lru_cache-weakref
diff Objects/stringobject.c @ 20604:7945639df265 legacy-trunk
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
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 22 Oct 2001 04:12:44 +0000 |
| parents | 98df0115ecf9 |
| children | 304b34023876 |
line wrap: on
line diff
--- a/Objects/stringobject.c Mon Oct 22 02:03:40 2001 +0000 +++ b/Objects/stringobject.c Mon Oct 22 04:12:44 2001 +0000 @@ -691,7 +691,7 @@ 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; }
