summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/cStringIO.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c
index 16d4173..9b39703 100644
--- a/Modules/cStringIO.c
+++ b/Modules/cStringIO.c
@@ -664,8 +664,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 void **)&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;