]> granicus.if.org Git - python/commitdiff
Made the TypeError message in bytes_iconcat() less confusing.
authorAlexandre Vassalotti <alexandre@peadrop.com>
Fri, 9 May 2008 19:50:27 +0000 (19:50 +0000)
committerAlexandre Vassalotti <alexandre@peadrop.com>
Fri, 9 May 2008 19:50:27 +0000 (19:50 +0000)
Before this change, the following example would output:

  >>> b = bytearray(b"hello")
  >>> b += "world"
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: can't concat bytes to bytearray

Objects/bytesobject.c

index e32331d138aab7ea270364a2e8b932adee5e613f..385429cbf2c393ff0690fd3405bb84bebb1975bd 100644 (file)
@@ -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;
     }