summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bz2.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_bz2.py')
-rw-r--r--Lib/test/test_bz2.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index 4646f02..366ab7a 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -120,6 +120,17 @@ class BZ2FileTest(BaseTest):
self.assertEqual(list(iter(bz2f)), sio.readlines())
bz2f.close()
+ def testClosedIteratorDeadlock(self):
+ # "Test that iteration on a closed bz2file releases the lock."
+ # http://bugs.python.org/issue3309
+ self.createTempFile()
+ bz2f = BZ2File(self.filename)
+ bz2f.close()
+ self.assertRaises(ValueError, bz2f.__next__)
+ # This call will deadlock of the above .__next__ call failed to
+ # release the lock.
+ self.assertRaises(ValueError, bz2f.readlines)
+
def testWrite(self):
# "Test BZ2File.write()"
bz2f = BZ2File(self.filename, "w")