summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_posix.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-01-08 14:26:12 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-01-08 14:26:12 (GMT)
commit149e540adf47ccd57ac36afe265b7740a9dd74fc (patch)
tree398a86594984dcd1df3877b11e9b82938a6fdd75 /Lib/test/test_posix.py
parente4314e05d5d96eed8a3f25db779f853fc5514969 (diff)
parent57ddf78b6b18d9da6f466b4e6da0437c3271196e (diff)
downloadcpython-149e540adf47ccd57ac36afe265b7740a9dd74fc.zip
cpython-149e540adf47ccd57ac36afe265b7740a9dd74fc.tar.gz
cpython-149e540adf47ccd57ac36afe265b7740a9dd74fc.tar.bz2
(Merge 3.3) Issue #20113: os.readv() and os.writev() now raise an OSError
exception on error instead of returning -1.
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r--Lib/test/test_posix.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 1eceebe..a9b3bdc 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -283,9 +283,14 @@ class PosixTester(unittest.TestCase):
def test_writev(self):
fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
try:
- os.writev(fd, (b'test1', b'tt2', b't3'))
+ n = os.writev(fd, (b'test1', b'tt2', b't3'))
+ self.assertEqual(n, 10)
+
os.lseek(fd, 0, os.SEEK_SET)
self.assertEqual(b'test1tt2t3', posix.read(fd, 10))
+
+ # Issue #20113: empty list of buffers should not crash
+ self.assertEqual(posix.writev(fd, []), 0)
finally:
os.close(fd)
@@ -298,6 +303,9 @@ class PosixTester(unittest.TestCase):
buf = [bytearray(i) for i in [5, 3, 2]]
self.assertEqual(posix.readv(fd, buf), 10)
self.assertEqual([b'test1', b'tt2', b't3'], [bytes(i) for i in buf])
+
+ # Issue #20113: empty list of buffers should not crash
+ self.assertEqual(posix.readv(fd, []), 0)
finally:
os.close(fd)