bpo-39357: Remove buffering parameter of bz2.BZ2File (GH-18028)
Remove the buffering parameter of bz2.BZ2File. Since Python 3.0, it
was ignored and using it was emitting a DeprecationWarning. Pass an
open file object to control how the file is opened.
The compresslevel parameter becomes keyword-only.
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index eb2f72e..030d564 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -100,6 +100,9 @@
self.assertRaises(ValueError, BZ2File, os.devnull, compresslevel=0)
self.assertRaises(ValueError, BZ2File, os.devnull, compresslevel=10)
+ # compresslevel is keyword-only
+ self.assertRaises(TypeError, BZ2File, os.devnull, "r", 3)
+
def testRead(self):
self.createTempFile()
with BZ2File(self.filename) as bz2f: