Make the StringIO test pass.
The buffer object now special-cases Unicode when concatenating. Sigh.
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 @@
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;