Skip to content

gzip raising exception when closing with buffer backed by BytesIO #129726

Closed
@xrmx

Description

@xrmx

Bug report

Bug description:

Hello,

the following snippet raises an exception in Python 3.13.2 while it's fine with Python 3.12.

import io import gzip def foo(): buffer = gzip.GzipFile(fileobj=io.BytesIO(), mode="w") foo()

Running this with python3.12 is silent, with Python 3.13.2 instead:

Exception ignored in: <gzip on 0x7fa4fd99c550> Traceback (most recent call last): File "/usr/lib/python3.13/gzip.py", line 359, in close fileobj.write(self.compress.flush()) 

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions