Skip to content
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

gh-128646: Implement GzipFile.readinto() functions #128647

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

effigies
Copy link
Contributor

@effigies effigies commented Jan 8, 2025

This PR adds implementations of .readinto() and .readinto1() for GzipFile which pass the received buffer to the underlying BufferedReader. Without this, the base BufferedIOReader implementation is used, which simply calls .read() and copies into the target buffer.

I don't know a good way to write a test to check memory usage, but see #128646 for a profile that demonstrates the effectiveness of the patch.

Copy link

cpython-cla-bot bot commented Jan 8, 2025

All commit authors signed the Contributor License Agreement.
CLA signed

@effigies effigies force-pushed the fix/gzipfile-readinto branch from 4eea459 to f272a9c Compare January 8, 2025 20:45
@effigies effigies force-pushed the fix/gzipfile-readinto branch from f272a9c to db7f971 Compare January 8, 2025 21:02
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.

1 participant