Skip to content

Conversation

JelleZijlstra
Copy link
Member

No description provided.

@github-actions
Copy link
Contributor

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

def flush(self) -> bytes: ...

@final
class BZ2Decompressor:
def decompress(self, data: bytes, max_length: int = ...) -> bytes: ...
def decompress(self, data: ReadableBuffer, max_length: int = ...) -> bytes: ...
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was a bit concerned here, as decompress uses while data: and I'm not sure if all buffers support that, but it turns out that data is overwritten with BZ2Decompressor.unused_data at the end of the first loop iteration, which appears to be bytes. So if push comes to shove, an empty bytes string is pushed into BZ2Decompressor.decompress() once (which has no effect), and then - since unused_data is now an empty bytes, it will exit the loop.

@srittau srittau merged commit cb90e9d into python:master Oct 28, 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