#8637·RustPython

compression: empty input marks BZ2/LZMA decompressors as EOF

Author: doma17Created Sep 2, 2026Updated Sep 2, 2026

Summary

Calling decompress(b"") before compressed input marks BZ2Decompressor and LZMADecompressor as finished.

Expected

Empty input should be a no-op. CPython keeps eof false and needs_input true, then accepts compressed data supplied by a later call:

BZ2Decompressor False True
b'data'
LZMADecompressor False True
b'data'

Actual

RustPython marks both decompressors as finished and rejects a later input:

BZ2Decompressor True False
EOFError: End of stream already reached
LZMADecompressor True False
EOFError: End of stream already reached

Python Documentation