[Python-checkins] r77783 - in python/branches/release31-maint: Lib/test/test_fileio.py Misc/NEWS Modules/_io/fileio.c
benjamin.peterson
python-checkins at python.org
Wed Jan 27 02:56:08 CET 2010
Author: benjamin.peterson
Date: Wed Jan 27 02:56:08 2010
New Revision: 77783
Log:
Merged revisions 77781-77782 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r77781 | benjamin.peterson | 2010-01-26 19:47:14 -0600 (Tue, 26 Jan 2010) | 1 line
don't accept bytes in FileIO.write #7785
........
r77782 | benjamin.peterson | 2010-01-26 19:51:29 -0600 (Tue, 26 Jan 2010) | 1 line
add issue number
........
Modified:
python/branches/release31-maint/ (props changed)
python/branches/release31-maint/Lib/test/test_fileio.py
python/branches/release31-maint/Misc/NEWS
python/branches/release31-maint/Modules/_io/fileio.c
Modified: python/branches/release31-maint/Lib/test/test_fileio.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_fileio.py (original)
+++ python/branches/release31-maint/Lib/test/test_fileio.py Wed Jan 27 02:56:08 2010
@@ -78,6 +78,9 @@
self.assertEqual(self.f.readline(None), b"hi\n")
self.assertEqual(self.f.readlines(None), [b"bye\n", b"abc"])
+ def test_reject(self):
+ self.assertRaises(TypeError, self.f.write, "Hello!")
+
def testRepr(self):
self.assertEquals(repr(self.f), "<_io.FileIO name=%r mode=%r>"
% (self.f.name, self.f.mode))
@@ -170,7 +173,7 @@
@ClosedFDRaises
def testErrnoOnClosedWrite(self, f):
- f.write('a')
+ f.write(b'a')
@ClosedFDRaises
def testErrnoOnClosedSeek(self, f):
Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS (original)
+++ python/branches/release31-maint/Misc/NEWS Wed Jan 27 02:56:08 2010
@@ -73,6 +73,8 @@
Library
-------
+- Issue #7785: Don't accept bytes in FileIO.write().
+
- Issue #7773: Fix an UnboundLocalError in platform.linux_distribution() when
the release file is empty.
Modified: python/branches/release31-maint/Modules/_io/fileio.c
==============================================================================
--- python/branches/release31-maint/Modules/_io/fileio.c (original)
+++ python/branches/release31-maint/Modules/_io/fileio.c Wed Jan 27 02:56:08 2010
@@ -651,7 +651,7 @@
if (!self->writable)
return err_mode("writing");
- if (!PyArg_ParseTuple(args, "s*", &pbuf))
+ if (!PyArg_ParseTuple(args, "y*", &pbuf))
return NULL;
if (_PyVerify_fd(self->fd)) {
More information about the Python-checkins
mailing list