GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — `BZ2Decompressor` and `zlib._ZlibDecompressor` set `needs_input=True` while output is still buffered · Issue #159999 · python/cpython Open Labels extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug descriptionWhen >>> import bz2, zlib >>> stream = bz2.compress(b"\x00\x10 0@" * 2) >>> d = bz2.BZ2Decompressor() >>> d.decompress(stream[:40], max_length=0) b'' >>> d.needs_input, d.eof (True, False) >>> d.decompress(b"") # Expecting: b'' if needs_input is to be believed b'\x00\x10 0@\x00\x10 0@' >>> d = zlib._ZlibDecompressor() >>> d.decompress(zlib.compress(b"\x00")[:4], max_length=0) b'' >>> d.needs_input True >>> d.decompress(b"") b'\x00'
>>> import lzma >>> d = lzma.LZMADecompressor() >>> d.decompress(lzma.compress(b"\x00" * 21), max_length=2) b'\x00\x00' >>> d.needs_input False The cause is that both modules decide As a practical matter I don't see a way for this to lose data for a caller following the documented protocol: the stream's trailer has not been consumed yet in these states, so the caller still has input to feed and will get the buffered output then. It does make Found by the Hypothesis tests in #159960, which record it as CPython versions tested onCPython main (4e3d5ec) Operating systems tested onLinux Linked PRsActivity
MetadataMetadataAssigneesLabelsextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error Projects
MilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |