diff options
author | Georg Brandl <georg@python.org> | 2006-10-12 09:47:12 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-10-12 09:47:12 (GMT) |
commit | 5597e261b2e46494d59bfbd7c6f2758f341ad910 (patch) | |
tree | 584016b9969d29b28266128276a63e9d4974bd2e /Modules | |
parent | b2e81e307dc7e7d8a552619b6defddb06e028613 (diff) | |
download | cpython-5597e261b2e46494d59bfbd7c6f2758f341ad910.zip cpython-5597e261b2e46494d59bfbd7c6f2758f341ad910.tar.gz cpython-5597e261b2e46494d59bfbd7c6f2758f341ad910.tar.bz2 |
Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode
arguments with the system default encoding just like the write()
method does, instead of converting it to a raw buffer.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/cStringIO.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c index 4debb72..03ef461 100644 --- a/Modules/cStringIO.c +++ b/Modules/cStringIO.c @@ -657,11 +657,9 @@ newIobject(PyObject *s) { char *buf; Py_ssize_t size; - if (PyObject_AsReadBuffer(s, (const void **)&buf, &size)) { - PyErr_Format(PyExc_TypeError, "expected read buffer, %.200s found", - s->ob_type->tp_name); + if (PyObject_AsCharBuffer(s, (const void **)&buf, &size) != 0) return NULL; - } + self = PyObject_New(Iobject, &Itype); if (!self) return NULL; Py_INCREF(s); |