Issue 5449: Fix io.BytesIO to not accept arbitrary keywords
Patch contributed by Erick Tryzelaar.
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c
index 7b56551..5ca878d 100644
--- a/Modules/_io/bytesio.c
+++ b/Modules/_io/bytesio.c
@@ -759,9 +759,11 @@
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. */