Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6f17deb

Browse files
committed
(Merge 3.3) Issue #20113: Fix test_posix on OpenIndiana
2 parents 149e540 + cd5ca6a commit 6f17deb

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

Lib/test/test_posix.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,14 @@ def test_writev(self):
290290
self.assertEqual(b'test1tt2t3', posix.read(fd, 10))
291291

292292
# Issue #20113: empty list of buffers should not crash
293-
self.assertEqual(posix.writev(fd, []), 0)
293+
try:
294+
size = posix.writev(fd, [])
295+
except OSError:
296+
# writev(fd, []) raises OSError(22, "Invalid argument")
297+
# on OpenIndiana
298+
pass
299+
else:
300+
self.assertEqual(size, 0)
294301
finally:
295302
os.close(fd)
296303

@@ -305,7 +312,14 @@ def test_readv(self):
305312
self.assertEqual([b'test1', b'tt2', b't3'], [bytes(i) for i in buf])
306313

307314
# Issue #20113: empty list of buffers should not crash
308-
self.assertEqual(posix.readv(fd, []), 0)
315+
try:
316+
size = posix.readv(fd, [])
317+
except OSError:
318+
# readv(fd, []) raises OSError(22, "Invalid argument")
319+
# on OpenIndiana
320+
pass
321+
else:
322+
self.assertEqual(size, 0)
309323
finally:
310324
os.close(fd)
311325

0 commit comments

Comments
 (0)