From: Alexandre Vassalotti Date: Fri, 9 May 2008 19:50:27 +0000 (+0000) Subject: Made the TypeError message in bytes_iconcat() less confusing. X-Git-Tag: v3.0b1~424 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=14a767d4f499c8ead06a14d9c64c01c4ced95e61;p=thirdparty%2FPython%2Fcpython.git Made the TypeError message in bytes_iconcat() less confusing. Before this change, the following example would output: >>> b = bytearray(b"hello") >>> b += "world" Traceback (most recent call last): File "", line 1, in TypeError: can't concat bytes to bytearray --- diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index e32331d138aa..385429cbf2c3 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -263,8 +263,8 @@ bytes_iconcat(PyBytesObject *self, PyObject *other) Py_buffer vo; if (_getbuffer(other, &vo) < 0) { - PyErr_Format(PyExc_TypeError, "can't concat bytes to %.100s", - Py_TYPE(self)->tp_name); + PyErr_Format(PyExc_TypeError, "can't concat %.100s to %.100s", + Py_TYPE(other)->tp_name, Py_TYPE(self)->tp_name); return NULL; }