mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
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.
This commit is contained in:
parent
b2e81e307d
commit
5597e261b2
3 changed files with 28 additions and 4 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue