Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2a502d8

Browse files
committed
Use 'S' format character for the optional constructor argument, so we
get a decent error message when it's not a string (instead of confusing errors when trying to use the thing).
1 parent d540509 commit 2a502d8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Modules/cStringIO.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ static PyObject *
565565
IO_StringIO(PyObject *self, PyObject *args) {
566566
PyObject *s=0;
567567

568-
UNLESS(PyArg_ParseTuple(args, "|O", &s)) return NULL;
568+
UNLESS(PyArg_ParseTuple(args, "|S", &s)) return NULL;
569569
if(s) return newIobject(s);
570570
return newOobject(128);
571571
}

0 commit comments

Comments
 (0)