Repository navigation
Keep negative-size range reads within the selected range - #633
Draft
Kayvan-Zahiri wants to merge 1 commit into
Draft
Kayvan-Zahiri wants to merge 1 commit into
Kayvan-Zahiri wants to merge 1 commit into
Conversation
3 of 7 tasks
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.
RangeOfInputStream.read(-1)passes the negative size directly to its underlying stream, which reads through the underlying EOF rather than stopping at the selected range boundary. This also consumes data from an empty or already exhausted range. For example, wrappingBytesIO(b"0123456789")with offset 2 and length 3 returnsb"23456789"rather thanb"234".Treat all negative sizes as an unbounded read of the remaining selected range, matching the existing
read(None)behavior. Add 14 tests through the exported v3 class covering negative/default/large/zero/bounded reads, partial reads, empty ranges, EOF, and positions. Includes the required changelog fragment.Validation on Python 3.12:
noxfile.py; the same discrepancy is present in HEAD.No hosted B2 integration or full Python/OS matrix run. AI-assisted contribution; maintainer review pending.