summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-08 23:08:31 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-08 23:08:31 (GMT)
commitbc14efbd08a0f9fce88b13b670df26e70f912104 (patch)
tree84bb4c2ecaa22e7f73f3488d3cbbef2d0b936e9b /Objects
parentcfe5f20fe82806b85c971e43e18564e60108dd08 (diff)
downloadcpython-bc14efbd08a0f9fce88b13b670df26e70f912104.zip
cpython-bc14efbd08a0f9fce88b13b670df26e70f912104.tar.gz
cpython-bc14efbd08a0f9fce88b13b670df26e70f912104.tar.bz2
Make the StringIO test pass.
The buffer object now special-cases Unicode when concatenating. Sigh.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bufferobject.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/Objects/bufferobject.c b/Objects/bufferobject.c
index ddef868..f635960 100644
--- a/Objects/bufferobject.c
+++ b/Objects/bufferobject.c
@@ -424,15 +424,24 @@ buffer_concat(PyBufferObject *self, PyObject *other)
return NULL;
/* optimize special case */
+ /* XXX bad idea type-wise */
if ( size == 0 )
{
Py_INCREF(other);
return other;
}
- if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 )
- return NULL;
+ if (PyUnicode_Check(other)) {
+ /* XXX HACK */
+ if ( (count = (*pb->bf_getcharbuffer)(other, 0, &ptr2)) < 0 )
+ return NULL;
+ }
+ else {
+ if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 )
+ return NULL;
+ }
+ /* XXX Should return a bytes object, really */
ob = PyString_FromStringAndSize(NULL, size + count);
if ( ob == NULL )
return NULL;