diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-05-09 19:50:27 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-05-09 19:50:27 (GMT) |
commit | 14a767d4f499c8ead06a14d9c64c01c4ced95e61 (patch) | |
tree | f6fbcb2fc908cd7bb749b624fb93c1f57199330c /Objects/bytesobject.c | |
parent | b2289ec60c2f2c6a7bc259e650871c6e860169f1 (diff) | |
download | cpython-14a767d4f499c8ead06a14d9c64c01c4ced95e61.zip cpython-14a767d4f499c8ead06a14d9c64c01c4ced95e61.tar.gz cpython-14a767d4f499c8ead06a14d9c64c01c4ced95e61.tar.bz2 |
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
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r-- | Objects/bytesobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index e32331d1..385429c 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; } |