[Python-3000-checkins] r62952 - python/branches/py3k/Objects/bytesobject.c

alexandre.vassalotti python-3000-checkins at python.org
Fri May 9 21:50:28 CEST 2008


Author: alexandre.vassalotti
Date: Fri May  9 21:50:27 2008
New Revision: 62952

Log:
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 "<stdin>", line 1, in <module>
  TypeError: can't concat bytes to bytearray



Modified:
   python/branches/py3k/Objects/bytesobject.c

Modified: python/branches/py3k/Objects/bytesobject.c
==============================================================================
--- python/branches/py3k/Objects/bytesobject.c	(original)
+++ python/branches/py3k/Objects/bytesobject.c	Fri May  9 21:50:27 2008
@@ -263,8 +263,8 @@
     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;
     }
 


More information about the Python-3000-checkins mailing list