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`.
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
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. */