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

gzip: improve bytes handling #9037

Merged
merged 3 commits into from
Oct 30, 2022
Merged

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Oct 29, 2022

@github-actions

This comment has been minimized.

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Thanks for all the bytes PRs!

stdlib/gzip.pyi Outdated
@@ -159,9 +159,9 @@ class _GzipReader(_compression.DecompressReader):
def __init__(self, fp: _ReadableFileobj) -> None: ...

if sys.version_info >= (3, 8):
def compress(data: bytes, compresslevel: int = ..., *, mtime: float | None = ...) -> bytes: ...
def compress(data: ReadableBuffer, compresslevel: int = ..., *, mtime: float | None = ...) -> bytes: ...
Copy link
Member

Choose a reason for hiding this comment

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

This also does len(data) in one branch, so we should use _BufferWithLen.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit e8595f3 into python:master Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants