[Python-checkins] cpython (2.7): some platforms apparently don't care about fdopen'ing with a different mode

benjamin.peterson python-checkins at python.org
Sun May 18 00:50:44 CEST 2014


http://hg.python.org/cpython/rev/cddd0e5374b2
changeset:   90740:cddd0e5374b2
branch:      2.7
parent:      90736:44dac2e7fcb8
user:        Benjamin Peterson <benjamin at python.org>
date:        Sat May 17 15:50:38 2014 -0700
summary:
  some platforms apparently don't care about fdopen'ing with a different mode

files:
  Lib/test/test_posix.py |  6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -195,7 +195,11 @@
         self.fdopen_helper('r', 100)
 
         fd = os.open(test_support.TESTFN, os.O_RDONLY)
-        self.assertRaises(OSError, posix.fdopen, fd, 'w')
+        try:
+            posix.fdopen(fd, 'w')
+        except OSError:
+            # This should happen on most platforms.
+            pass
         os.close(fd) # fd should not be closed.
 
     @unittest.skipUnless(hasattr(posix, 'O_EXLOCK'),

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list