[Python-checkins] r74372 - in python/branches/release31-maint: Doc/library/codecs.rst Lib/test/test_memoryio.py Modules/_io/bytesio.c

georg.brandl python-checkins at python.org
Thu Aug 13 10:35:19 CEST 2009


Author: georg.brandl
Date: Thu Aug 13 10:35:19 2009
New Revision: 74372

Log:
Merged revisions 74316,74335 via svnmerge from 
svn+ssh://svn.python.org/python/branches/py3k

........
  r74316 | alexandre.vassalotti | 2009-08-05 01:19:13 +0200 (Mi, 05 Aug 2009) | 4 lines
  
  Issue 5449: Fix io.BytesIO to not accept arbitrary keywords
  
  Patch contributed by Erick Tryzelaar.
........
  r74335 | philip.jenvey | 2009-08-06 22:00:08 +0200 (Do, 06 Aug 2009) | 1 line
  
  typo
........


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Doc/library/codecs.rst
   python/branches/release31-maint/Lib/test/test_memoryio.py
   python/branches/release31-maint/Modules/_io/bytesio.c

Modified: python/branches/release31-maint/Doc/library/codecs.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/codecs.rst	(original)
+++ python/branches/release31-maint/Doc/library/codecs.rst	Thu Aug 13 10:35:19 2009
@@ -74,7 +74,7 @@
    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`.
 

Modified: python/branches/release31-maint/Lib/test/test_memoryio.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_memoryio.py	(original)
+++ python/branches/release31-maint/Lib/test/test_memoryio.py	Thu Aug 13 10:35:19 2009
@@ -416,6 +416,10 @@
         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

Modified: python/branches/release31-maint/Modules/_io/bytesio.c
==============================================================================
--- python/branches/release31-maint/Modules/_io/bytesio.c	(original)
+++ python/branches/release31-maint/Modules/_io/bytesio.c	Thu Aug 13 10:35:19 2009
@@ -642,9 +642,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. */


More information about the Python-checkins mailing list