Skip to content

gh-137571: Fix UnboundLocalError in gzip._GzipReader.read() - #137572

Closed
maurycy wants to merge 2 commits into
python:mainfrom
maurycy:fix-issue-137571
Closed

gh-137571: Fix UnboundLocalError in gzip._GzipReader.read()#137572
maurycy wants to merge 2 commits into
python:mainfrom
maurycy:fix-issue-137571

Conversation

@maurycy

@maurycymaurycy commented Aug 8, 2025

Copy link
Copy Markdown
Contributor

Much more detailed description, including the reproduction steps, in the issue.

I'm not 100% sure about the fix. The easiest is just a sentinel (buf = None).

@maurycymaurycy changed the title gh-137571: gzip: Fix UnboundLocalError in gzip._GzipReader.read()gh-137571: Fix UnboundLocalError in gzip._GzipReader.read()Aug 8, 2025

@serhiy-storchakaserhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may change the behavior. Before, the error was raised only if both uncompress and buf are empty. Now it is raised without an attempt to decompress.

@maurycy

Copy link
Copy Markdown
ContributorAuthor

6 months passed; stale.

@maurycymaurycy closed this Mar 23, 2026
@serhiy-storchaka

Copy link
Copy Markdown
Member

@maurycy, it was stale because you have not addressed my comment.

#150222 will fix this issue without changing behavior for other cases.

@maurycy
maurycy deleted the fix-issue-137571 branch May 22, 2026 08:26
@maurycy

Copy link
Copy Markdown
ContributorAuthor

@serhiy-storchaka Thank you for picking this up. You're right, and #150222 is a cleaner fix. Apologies for letting this go on my end.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@maurycy@serhiy-storchaka