summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-04-13 01:39:34 (GMT)
committerGuido van Rossum <guido@python.org>2007-04-13 01:39:34 (GMT)
commitad7d8d10b70b62b25fc8ebd1a6bfef0c008a232a (patch)
tree2889cee1ac3e392aac63e7fc848e314d7cf2cda2 /Objects/stringobject.c
parentdc0b1a106981ee204936221f4e0863bd1d7a6ba6 (diff)
downloadcpython-ad7d8d10b70b62b25fc8ebd1a6bfef0c008a232a.zip
cpython-ad7d8d10b70b62b25fc8ebd1a6bfef0c008a232a.tar.gz
cpython-ad7d8d10b70b62b25fc8ebd1a6bfef0c008a232a.tar.bz2
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.)
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r--Objects/stringobject.c2
1 files changed, 2 insertions, 0 deletions
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 @@ string_concat(register PyStringObject *a, register PyObject *bb)
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);