diff Objects/stringobject.c @ 41450:d1c3dd184e38

Rough and dirty job -- allow concatenation of bytes and arbitrary buffer-supporting objects (Unicode always excluded), and also of str and bytes. (For some reason u"" + b"" doesn't fail, I'll investigate later.)
author Guido van Rossum <guido@python.org>
date Fri, 13 Apr 2007 01:39:34 +0000
parents 03883acb650b
children 06145fbc7ab9
line wrap: on
line diff
--- a/Objects/stringobject.c	Thu Apr 12 22:55:07 2007 +0000
+++ b/Objects/stringobject.c	Fri Apr 13 01:39:34 2007 +0000
@@ -948,6 +948,8 @@
 		if (PyUnicode_Check(bb))
 		    return PyUnicode_Concat((PyObject *)a, bb);
 #endif
+                if (PyBytes_Check(bb))
+			return PyBytes_Concat((PyObject *)a, bb);
 		PyErr_Format(PyExc_TypeError,
 			     "cannot concatenate 'str' and '%.200s' objects",
 			     bb->ob_type->tp_name);