summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/library/codecs.rst2
-rw-r--r--Lib/test/test_memoryio.py4
-rw-r--r--Modules/_io/bytesio.c4
3 files changed, 8 insertions, 2 deletions
diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst
index 7218d3a..b8a8ccc 100644
--- a/Doc/library/codecs.rst
+++ b/Doc/library/codecs.rst
@@ -74,7 +74,7 @@ It defines the following functions:
continue without further notice), ``'xmlcharrefreplace'`` (replace with the
appropriate XML character reference (for encoding only)),
``'backslashreplace'`` (replace with backslashed escape sequences (for
- encoding only)), ``'surrogateescape'`` (replae with surrogate U+DCxx, see
+ encoding only)), ``'surrogateescape'`` (replace with surrogate U+DCxx, see
:pep:`383`) as well as any other error handling name defined via
:func:`register_error`.
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py
index 0d044e9..187adad 100644
--- a/Lib/test/test_memoryio.py
+++ b/Lib/test/test_memoryio.py
@@ -416,6 +416,10 @@ class PyBytesIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase):
self.assertEqual(memio.write(a), 10)
self.assertEqual(memio.getvalue(), buf)
+ def test_issue5449(self):
+ buf = self.buftype("1234567890")
+ self.ioclass(initial_bytes=buf)
+ self.assertRaises(TypeError, self.ioclass, buf, foo=None)
class PyStringIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase):
buftype = str
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c
index 7675846..cafe4a2 100644
--- a/Modules/_io/bytesio.c
+++ b/Modules/_io/bytesio.c
@@ -642,9 +642,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. */