diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-04-09 19:40:18 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-04-09 19:40:18 (GMT) |
commit | 02ab7a84ef86cfe043bbfbbd2912dcc8c8c67793 (patch) | |
tree | 8e49d11fc2469920a5e0814d2ca90b251963c9f3 /Lib/test/test_posix.py | |
parent | d5460096778dcb700f850c16c6ad63531430d433 (diff) | |
download | cpython-02ab7a84ef86cfe043bbfbbd2912dcc8c8c67793.zip cpython-02ab7a84ef86cfe043bbfbbd2912dcc8c8c67793.tar.gz cpython-02ab7a84ef86cfe043bbfbbd2912dcc8c8c67793.tar.bz2 |
make sure fdopen always closes the fd in error cases (closes #21191)
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r-- | Lib/test/test_posix.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 76a74fb..243fd5d 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -194,6 +194,10 @@ class PosixTester(unittest.TestCase): self.fdopen_helper('r') self.fdopen_helper('r', 100) + fd = os.open(test_support.TESTFN, os.O_RDONLY) + self.assertRaises(OSError, posix.fdopen, fd, 'w') + self.assertRaises(OSError, os.close, fd) # fd should be closed. + @unittest.skipUnless(hasattr(posix, 'O_EXLOCK'), 'test needs posix.O_EXLOCK') def test_osexlock(self): |