BZ2File now uses the compresslevel argument given by the caller,

instead of ignoring it and always using a compression level of 9.
This commit is contained in:
Nadeem Vawda 2011-09-11 22:38:11 +02:00
parent c92f6226d7
commit 249ab5e8d1
2 changed files with 9 additions and 2 deletions

View file

@ -75,11 +75,11 @@ class BZ2File(io.BufferedIOBase):
elif mode in ("w", "wb"):
mode = "wb"
mode_code = _MODE_WRITE
self._compressor = BZ2Compressor()
self._compressor = BZ2Compressor(compresslevel)
elif mode in ("a", "ab"):
mode = "ab"
mode_code = _MODE_WRITE
self._compressor = BZ2Compressor()
self._compressor = BZ2Compressor(compresslevel)
else:
raise ValueError("Invalid mode: {!r}".format(mode))