Issue 5449: Fix io.BytesIO to not accept arbitrary keywords

Patch contributed by Erick Tryzelaar.
This commit is contained in:
Alexandre Vassalotti 2009-08-04 23:19:13 +00:00
parent bbffb25c69
commit ba5c74329d
2 changed files with 8 additions and 1 deletions

View file

@ -759,9 +759,11 @@ bytesio_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static int
bytesio_init(bytesio *self, PyObject *args, PyObject *kwds)
{
char *kwlist[] = {"initial_bytes", NULL};
PyObject *initvalue = NULL;
if (!PyArg_ParseTuple(args, "|O:BytesIO", &initvalue))
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:BytesIO", kwlist,
&initvalue))
return -1;
/* In case, __init__ is called multiple times. */