Repository navigation
fix(protocol): raise StructError from _read_binary at end of stream (#2292) - #2368
Merged
Merged
Conversation
…2292) Problem: _read_binary called ord() on each read(1) without checking an octet arrived, so an exhausted or short stream raised TypeError where _read_unpack raises StructError. Fix: read size octets once; raise StructError with eof set on an empty read and StructError on a short one, as _read_unpack does, and document Raises. Test: test_read_binary_raises_struct_error_at_end_of_stream.
Owner
Author
|
Review: GOOD TO GO at
|
Owner
Author
|
Ready to merge. Review: GOOD TO GO (Sonnet) at |
Contributor
|
Coverage: 91.58% (unit tier, Python 3.15,
Per-file detail: the |
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix — bug fixDescription
Closes #2292.
_read_binaryon an exhausted stream now raisesStructError('unpack: empty buffer', quiet=True, eof=True)instead of a bareTypeErrorfromord()on an empty read. A size of 0 or less still returns''without reading.origin/main. Passing on the rebased head.