Mercurial > cpython-lru_cache-weakref
diff Modules/cStringIO.c @ 23301:5732a9cc91c7 legacy-trunk
See discussion at SF bug 547537.
Unicode objects are currently taken as binary data by the write()
method. This is not what Unicode users expect, nor what the
StringIO.py code does. Until somebody adds a way to specify binary or
text mode for cStringIO objects, change the format string to use "t#"
instead of "s#", so that it will request the "text buffer" version.
This will try the default encoding for Unicode objects.
This is *not* a 2.2 bugfix (since it *is* a semantic change).
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 29 Apr 2002 13:54:48 +0000 |
| parents | f1af8ad11000 |
| children | ed1ba37a46b7 |
line wrap: on
line diff
--- a/Modules/cStringIO.c Mon Apr 29 01:37:32 2002 +0000 +++ b/Modules/cStringIO.c Mon Apr 29 13:54:48 2002 +0000 @@ -376,7 +376,7 @@ char *c; int l; - UNLESS (PyArg_ParseTuple(args, "s#:write", &c, &l)) return NULL; + UNLESS (PyArg_ParseTuple(args, "t#:write", &c, &l)) return NULL; if (O_cwrite((PyObject*)self,c,l) < 0) return NULL;
