Issue #13809: Make bz2 module work with threads disabled.
Original patch by Amaury Forgeot d'Arc.
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index bd40f83..0f8d149 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -463,6 +463,13 @@
for t in threads:
t.join()
+ def testWithoutThreading(self):
+ bz2 = support.import_fresh_module("bz2", blocked=("threading",))
+ with bz2.BZ2File(self.filename, "wb") as f:
+ f.write(b"abc")
+ with bz2.BZ2File(self.filename, "rb") as f:
+ self.assertEqual(f.read(), b"abc")
+
def testMixedIterationAndReads(self):
self.createTempFile()
linelen = len(self.TEXT_LINES[0])