-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-71316: Update dis documentation to include changes to jump arguments #95798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-71316: Update dis documentation to include changes to jump arguments #95798
Conversation
Since 3.10, the instruction offset is used instead of the byte offset. Thus, for jump instructions, the argument is half of what it would of been in 3.9. For instance, this code: def test(x): return 1 if x else 0 in 3.9 disassembles into 4 0 LOAD_FAST 0 (x) 2 POP_JUMP_IF_FALSE 8 4 LOAD_CONST 1 (1) 6 RETURN_VALUE >> 8 LOAD_CONST 2 (0) 10 RETURN_VALUE but in 3.10 disassembles into 4 0 LOAD_FAST 0 (x) 2 POP_JUMP_IF_FALSE 4 (to 8) 4 LOAD_CONST 1 (1) 6 RETURN_VALUE >> 8 LOAD_CONST 2 (0) 10 RETURN_VALUE
This is related to #71316. CC @markshannon . |
Thanks @Christopher-Chianelli for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
GH-98028 is a backport of this pull request to the 3.11 branch. |
Sorry, @Christopher-Chianelli and @iritkatriel, I could not cleanly backport this to |
…rguments (pythonGH-95798) (cherry picked from commit 6592a62) Co-authored-by: Christopher Chianelli <[email protected]>
…ts (GH-95798) (cherry picked from commit 6592a62) Co-authored-by: Christopher Chianelli <[email protected]>
… jump arguments (pythonGH-95798). (cherry picked from commit 6592a62) Co-authored-by: Christopher Chianelli <[email protected]>
… jump arguments (pythonGH-95798). (cherry picked from commit 6592a62) Co-authored-by: Christopher Chianelli <[email protected]>
GH-98029 is a backport of this pull request to the 3.10 branch. |
…arguments (GH-95798). (GH-98029) (cherry picked from commit 6592a62) Co-authored-by: Christopher Chianelli <[email protected]>
…ts (GH-95798) (cherry picked from commit 6592a62) Co-authored-by: Christopher Chianelli <[email protected]>
Since 3.10, the instruction offset is used instead of the byte
offset. Thus, for jump instructions, the argument is half
of what it would of been in 3.9. For instance, this code:
def test(x):
return 1 if x else 0
in 3.9 disassembles into
4 0 LOAD_FAST 0 (x)
2 POP_JUMP_IF_FALSE 8
4 LOAD_CONST 1 (1)
6 RETURN_VALUE
>> 8 LOAD_CONST 2 (0)
10 RETURN_VALUE
but in 3.10 disassembles into
4 0 LOAD_FAST 0 (x)
2 POP_JUMP_IF_FALSE 4 (to 8)
4 LOAD_CONST 1 (1)
6 RETURN_VALUE
>> 8 LOAD_CONST 2 (0)
10 RETURN_VALUE