Repository navigation
Conversation
This branch has not been deployed
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.


FileStructure.struntil(v)is documented to return the structure up to and including fieldv, but it ended withreturn structure[:-1], which dropped the last byte of that final field. Sostruntil("flags")returned 7 bytes instead of the full 8, and every call came back one byte short. This removes the truncation so the payload includes the whole of fieldv, as the docstring already promises.This also affects
write()andread(), which build their payloads fromstruntil('fileno'). Their output is now 116 bytes where it used to be 115. The extra byte is the final byte of thefilenofield that was previously being cut off, so this is the corrected behaviour rather than a change in intent, and the doctests for both methods have been updated to match.The stray slice has been there since the module was first added, and there's no compensating logic elsewhere.
struntilhas no other callers in the tree, so the blast radius is limited to these three doctests.Testing
Updated the three existing doctests whose expected output gains a byte (
struntil("_IO_buf_end"),write(),read()), and added two length checks to thestruntildocstring so the expected sizes are explicit:gives 43 passed, 0 failures (it was 41 before). Also checked on i386, where
struntil("flags")correctly returns 4 bytes.Target Branch
Targeting
dev. The issue is labelledbackport-required— happy to redo this againststableorbetaif you'd rather it land there first.Fixes #2403.