mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
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.)
This commit is contained in:
parent
dc0b1a1069
commit
ad7d8d10b7
5 changed files with 213 additions and 73 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue