Mercurial > cpython-lru_cache-weakref
diff Modules/cStringIO.c @ 40100:6e6c220c2fa6 2.5
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.
(backport from rev. 52301)
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Thu, 12 Oct 2006 09:47:17 +0000 |
| parents | 5e1b6f553763 |
| children | 498cf4b09d8a |
line wrap: on
line diff
--- a/Modules/cStringIO.c Thu Oct 12 09:20:36 2006 +0000 +++ b/Modules/cStringIO.c Thu Oct 12 09:47:17 2006 +0000 @@ -657,11 +657,9 @@ 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);
