]> granicus.if.org Git - python/commitdiff
Use 'S' format character for the optional constructor argument, so we
authorGuido van Rossum <guido@python.org>
Fri, 24 Jul 1998 19:53:54 +0000 (19:53 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 24 Jul 1998 19:53:54 +0000 (19:53 +0000)
get a decent error message when it's not a string (instead of
confusing errors when trying to use the thing).

Modules/cStringIO.c

index 2d7c940c08c5ae550fb66814be2ffe3380e2401d..494d895d3d91df9b3b1745343558f891640c70c3 100644 (file)
@@ -565,7 +565,7 @@ static PyObject *
 IO_StringIO(PyObject *self, PyObject *args) {
   PyObject *s=0;
 
-  UNLESS(PyArg_ParseTuple(args, "|O", &s)) return NULL;
+  UNLESS(PyArg_ParseTuple(args, "|S", &s)) return NULL;
   if(s) return newIobject(s);
   return newOobject(128);
 }