Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maurycy
Copy link
Contributor

@maurycy maurycy commented Aug 8, 2025

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).

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

@serhiy-storchaka serhiy-storchaka left a comment

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.

Sign up for free to 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