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.)
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 7212df9..94943f6 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -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);