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 — GzipFile.flush doesn't flush compressor in 3.12 beta · Issue #105808 · python/cpython Closed Labels 3.12only security fixesonly security fixesrelease-blockertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportThe change to add buffering to Here is a test script, reduced from Tornado's use of GzipFile (see tornadoweb/tornado#3278 for the way this manifests in Tornado's test suite): import io import gzip import zlib # Write two chunks to the same compressed stream. In real usage # I send these chunks as two separate network messages, but in this # test I just save them to two local variables. data = io.BytesIO() gzip_file = gzip.GzipFile(fileobj=data, mode="wb") gzip_file.write(b"Hello World") gzip_file.flush() message1 = data.getvalue() data.truncate(0) data.seek(0) gzip_file.write(b"Goodbye World") gzip_file.close() message2 = data.getvalue() # Decode the two messages. Each one should decode separately, # but in Python 3.12b2 the compressor was not flushed with # Z_SYNC_FLUSH so the second message produces no output on its own # and both messages are emitted when the second message is added # to the decompressor's input. # # This results in the error # AssertionError: [b'', b'Hello WorldGoodbye World'] decompressor = zlib.decompressobj(16 + zlib.MAX_WBITS) messages = [decompressor.decompress(message1), decompressor.decompress(message2)] assert messages == [b"Hello World", b"Goodbye World"], messages Your environment
Linked PRsActivity
MetadataMetadataAssigneesLabels3.12only security fixesonly security fixesrelease-blockertype-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. |