Repository navigation
gh-160811: fix TextIOWrapper.tell() after seek() past a carriage return - #160812
Open
tonghuaroot wants to merge 1 commit into
Open
tonghuaroot wants to merge 1 commit into
tonghuaroot wants to merge 1 commit into
Conversation
…e return seek() to a cookie with chars_to_skip replayed the input chunk without updating the bytes-per-char ratio, so tell() could compute skip_bytes larger than the snapshot buffer. In the C implementation this read past the end of the buffer, and _pyio returned a wrong position.
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.
seek()to a cookie withchars_to_skip > 0replays the input chunk into a new snapshot but kept the bytes-per-char ratio from the previous_read_chunk(), sotell()could compute a skip larger than the snapshot. the C implementation then read past the bytes object, and_pyioreturned a position one character too far. this sets the ratio from the replayed chunk in both implementations, the same way_read_chunk()does, and adds a regression test for the C and pure-Python classes. backports to 3.14 and 3.13 need the test moved toLib/test/test_io.py.