summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2012-12-29 20:25:59 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2012-12-29 20:25:59 (GMT)
commit4ed797efbc2401d34c95bbb0cea921535c868d16 (patch)
tree0ea4ac643b5384bb4ee32959b1df1feb5499ed77 /Lib/test
parent40f12ab0c5c5adc4a8b4a03a57ffa94c87ecc2cb (diff)
downloadcpython-4ed797efbc2401d34c95bbb0cea921535c868d16.zip
cpython-4ed797efbc2401d34c95bbb0cea921535c868d16.tar.gz
cpython-4ed797efbc2401d34c95bbb0cea921535c868d16.tar.bz2
Issue #16485: Fix file descriptor not being closed if file header patching fails on closing of aifc file.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_aifc.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py
index e492838..62b3d18 100644
--- a/Lib/test/test_aifc.py
+++ b/Lib/test/test_aifc.py
@@ -106,6 +106,13 @@ class AIFCTest(unittest.TestCase):
self.assertEqual(testfile.closed, False)
f.close()
self.assertEqual(testfile.closed, True)
+ testfile = open(TESTFN, 'wb')
+ fout = aifc.open(testfile, 'wb')
+ self.assertFalse(testfile.closed)
+ with self.assertRaises(aifc.Error):
+ fout.close()
+ self.assertTrue(testfile.closed)
+ fout.close() # do nothing
class AIFCLowLevelTest(unittest.TestCase):