diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fa72ae40..a1e5899d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -131,6 +131,8 @@ version 1.8.1-dev + Fix a crash on macOS and PyPy when there is not enough memory to create the internal lock of an ``isal_zlib.Compress``, ``isal_zlib.Decompress``, or ``igzip_lib.IgzipDecompressor`` object. It raises ``MemoryError`` now. ++ Fix the ``-0`` and ``--fast`` options of ``python -m isal.igzip``, which + compressed at level 2 instead of level 0. version 1.8.0 ----------------- diff --git a/src/isal/igzip.py b/src/isal/igzip.py index 6496a465..eb9b8042 100644 --- a/src/isal/igzip.py +++ b/src/isal/igzip.py @@ -305,7 +305,8 @@ def _argument_parser(): "-3", "--best", action="store_const", dest="compresslevel", const=_COMPRESS_LEVEL_BEST, help="use compression level 3 (best)") - compress_group.set_defaults(compress=True) + compress_group.set_defaults(compress=True, + compresslevel=_COMPRESS_LEVEL_TRADEOFF) compress_group.add_argument( "-d", "--decompress", action="store_const", dest="compress", @@ -333,7 +334,7 @@ def main(): import shutil # Only the command line interface needs it args = _argument_parser().parse_args() - compresslevel = args.compresslevel or _COMPRESS_LEVEL_TRADEOFF + compresslevel = args.compresslevel if args.output: out_filepath = args.output diff --git a/tests/test_igzip.py b/tests/test_igzip.py index b31adb85..ee564f98 100644 --- a/tests/test_igzip.py +++ b/tests/test_igzip.py @@ -220,6 +220,8 @@ def test_compress_stdin_stdout(monkeypatch, capsysbinary, level): out, err = capsysbinary.readouterr() assert err == b'' assert gzip.decompress(out) == DATA + # The XFL byte of the gzip header is 4 only at the fastest level. + assert out[8] == (4 if level == "0" else 0) def test_decompress_infile_outfile(monkeypatch, tmp_path, capsysbinary):