gh-154848: Add check_frames option to pickletools.dis() and genops() - #154909
Open
serhiy-storchaka wants to merge 2 commits into
Open
gh-154848: Add check_frames option to pickletools.dis() and genops()#154909serhiy-storchaka wants to merge 2 commits into
serhiy-storchaka wants to merge 2 commits into
Conversation
…ops() Framing (PEP 3154) is ignored by default, as an unpickler is free to do. When check_frames is true, an argument that straddles a frame boundary, or a frame that begins before the previous one ends, raises ValueError, as in the standard unpickler. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Documentation build overview
|
The tests only use opcodes available in protocol 4 (FRAME being the newest), so the PROTO header now declares protocol 4 instead of 5. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
PEP 3154 framing is a performance optimization, not part of the pickle semantics — an unpickler is free to ignore
FRAMEopcodes and read straight through.pickletoolsdoes exactly that, so it can disassemble a pickle whose arguments straddle frame boundaries into something a strict unpickler (such as CPython's) would reject.dis()andgenops()now accept acheck_frameskeyword argument. When true, an argument that straddles a frame boundary, or a frame that begins before the previous one ends, raisesValueError, as in the standard unpickler. Framing is still ignored by default, so existing behavior is unchanged.