Skip to content

GH-94438: Handle extended arguments and conditional pops in mark_stacks #95110

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

Merged
merged 15 commits into from
Jul 22, 2022

Conversation

brandtbucher
Copy link
Member

@brandtbucher brandtbucher commented Jul 21, 2022

mark_stacks hasn't handled extended arguments correctly for some time now:

  • the get_arg helper function checks for EXTENDED_ARG opcodes, but it should be checking for EXTENDED_ARG_QUICK (which is what the compiler and _PyCode_GetCode produce)
  • the default case doesn't call get_arg, but should

I've added some regression tests, as well as a few assertions that would have made catching and debugging this issue much easier.

@brandtbucher brandtbucher added type-crash A hard crash of the interpreter, possibly with a core dump needs backport to 3.11 only security fixes labels Jul 21, 2022
@brandtbucher brandtbucher self-assigned this Jul 21, 2022
@brandtbucher
Copy link
Member Author

See also #95113. If we go that route, this PR will need to be updated.

@mdboom
Copy link
Contributor

mdboom commented Jul 22, 2022

This will probably tick some coverage boxes in #94808.

@brandtbucher
Copy link
Member Author

I also noticed that we're not treating JUMP_IF_*_OR_POP like the forward jumps they are. Fixing that too...

@brandtbucher brandtbucher changed the title GH-94438: Handle extended arguments in mark_stacks GH-94438: Handle extended arguments and conditional pops in mark_stacks Jul 22, 2022
@brandtbucher brandtbucher merged commit e4d3a96 into python:main Jul 22, 2022
@miss-islington
Copy link
Contributor

Thanks @brandtbucher for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@brandtbucher brandtbucher deleted the mark-stacks branch July 22, 2022 23:28
@miss-islington
Copy link
Contributor

Sorry @brandtbucher, I had trouble checking out the 3.11 backport branch.
Please backport using cherry_picker on command line.
cherry_picker e4d3a96a113070fde433834a6c9fb79ebeebad4a 3.11

@brandtbucher brandtbucher added needs backport to 3.11 only security fixes and removed needs backport to 3.11 only security fixes labels Jul 22, 2022
@miss-islington
Copy link
Contributor

Thanks @brandtbucher for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 22, 2022
…k_stacks (pythonGH-95110)

(cherry picked from commit e4d3a96)

Co-authored-by: Brandt Bucher <[email protected]>
@bedevere-bot
Copy link

GH-95154 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jul 22, 2022
miss-islington added a commit that referenced this pull request Jul 22, 2022
…ks (GH-95110)

(cherry picked from commit e4d3a96)

Co-authored-by: Brandt Bucher <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants