diff options
author | Georg Brandl <georg@python.org> | 2007-08-08 13:03:41 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-08-08 13:03:41 (GMT) |
commit | 9616444427cbbc5283f21a09ffa852ad21805588 (patch) | |
tree | 4e317891a8fc12947cad39710b84961ebc775221 /Modules | |
parent | 52c0c368b9d279f4972e15f596616a436e5e2a6e (diff) | |
download | cpython-9616444427cbbc5283f21a09ffa852ad21805588.zip cpython-9616444427cbbc5283f21a09ffa852ad21805588.tar.gz cpython-9616444427cbbc5283f21a09ffa852ad21805588.tar.bz2 |
Revert the fix for #1548891, it broke backwards compatibility with arbitrary read buffers.
Fixes #1730114.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/cStringIO.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c index 5834e20..0cc9c6b 100644 --- a/Modules/cStringIO.c +++ b/Modules/cStringIO.c @@ -673,8 +673,11 @@ newIobject(PyObject *s) { char *buf; Py_ssize_t size; - if (PyObject_AsCharBuffer(s, (const char **)&buf, &size) != 0) - return NULL; + if (PyObject_AsReadBuffer(s, (const char **)&buf, &size)) { + PyErr_Format(PyExc_TypeError, "expected read buffer, %.200s found", + s->ob_type->tp_name); + return NULL; + } self = PyObject_New(Iobject, &Itype); if (!self) return NULL; |