summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2008-12-23 03:35:04 +0000
committerSkip Montanaro <skip@pobox.com>2008-12-23 03:35:04 +0000
commit6a00c74211c555b48faf17f5da9baca4ba2eb468 (patch)
tree72644105e8dc62ed7ab560d06f77dedb83d2f747
parentc6e80eb5eeee1170b770c456adac62eccb36ac71 (diff)
downloadcpython-git-6a00c74211c555b48faf17f5da9baca4ba2eb468.tar.gz
Merged revisions 67908 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r67908 | skip.montanaro | 2008-12-22 21:30:15 -0600 (Mon, 22 Dec 2008) | 4 lines As a result of a regression that snuck into 2.5.3 add a test case that ensures that when you try to read from a file opened for writing an IOError is raised. ........
-rw-r--r--Lib/test/test_file.py2
-rw-r--r--Misc/NEWS3
2 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py
index 2d791a55c0..96f6da2023 100644
--- a/Lib/test/test_file.py
+++ b/Lib/test/test_file.py
@@ -120,6 +120,8 @@ class AutoFileTests(unittest.TestCase):
except:
self.assertEquals(self.f.__exit__(*sys.exc_info()), None)
+ def testReadWhenWriting(self):
+ self.assertRaises(IOError, self.f.read)
class OtherFileTests(unittest.TestCase):
diff --git a/Misc/NEWS b/Misc/NEWS
index 4eba4f6d2a..a305843c44 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6.2
Core and Builtins
-----------------
+- Added test case to ensure attempts to read from a file opened for writing
+ fail.
+
- Issue #4597: Fixed several opcodes that weren't always propagating
exceptions.