close
Skip to content

gh-149498: Fix dis.FOR_ITER reporting wrong exhausted-path jump target#149503

Open
P403n1x87 wants to merge 2 commits intopython:mainfrom
P403n1x87:gh-149498-fix-for-iter-jump-target
Open

gh-149498: Fix dis.FOR_ITER reporting wrong exhausted-path jump target#149503
P403n1x87 wants to merge 2 commits intopython:mainfrom
P403n1x87:gh-149498-fix-for-iter-jump-target

Conversation

@P403n1x87
Copy link
Copy Markdown
Contributor

@P403n1x87 P403n1x87 commented May 7, 2026

FOR_ITER uses JUMPBY(oparg + 1) at runtime, landing on POP_ITER (past END_FOR). dis was computing the target as NIP + oparg*2, landing on END_FOR instead. Add the extra 2 bytes for FOR_ITER in both _get_jump_target and ArgResolver.offset_from_jump_arg so that jump_target, findlabels, and argrepr all reflect the actual runtime behaviour.

… target

FOR_ITER uses JUMPBY(oparg + 1) at runtime, landing on POP_ITER (past
END_FOR). dis was computing the target as NIP + oparg*2, landing on
END_FOR instead. Add the extra 2 bytes for FOR_ITER in both
_get_jump_target and ArgResolver.offset_from_jump_arg so that
jump_target, findlabels, and argrepr all reflect the actual runtime
behaviour.
@P403n1x87 P403n1x87 force-pushed the gh-149498-fix-for-iter-jump-target branch from d69d0f5 to 0d308eb Compare May 7, 2026 17:28
@StanFromIreland
Copy link
Copy Markdown
Member

Updating to fix some errors we introduced on the main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants