-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-143820: ENTER_EXECUTOR can be inserted after BINARY_OP_INPLACE_ADD_UNICODE #143894
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
base: main
Are you sure you want to change the base?
Conversation
markshannon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provided that _BINARY_OP_INPLACE_ADD_UNICODE leaves the VM in a valid state (and I believe it does), then it doesn't matter if the following STORE_FAST is replaced by ENTER_EXECUTOR or instrumented.
It is the assert that needs changing. You'll need to use _Py_GetBaseCodeUnit
|
When you're done making the requested changes, leave the comment: |
It matters because we get the next instruction's oparg and check it |
|
We need to check for |
markshannon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test case seems to have a lot of extra stuff in it, but no check that it is testing what it is supposed to be testing.
Can we tidy it up and add a check that it it working?
| # https://github.com/python/cpython/issues/143358 | ||
|
|
||
| result = script_helper.run_python_until_end('-c', textwrap.dedent(f""" | ||
| import sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems like a lot of extraneous stuff in this test, and no check that the STORE_FAST is overwritten by an ENTER_EXECUTOR.
| next_oparg = exec->vm_data.oparg; | ||
| } | ||
| #endif | ||
| assert(next_instr->op.code == STORE_FAST || next_instr->op.code == ENTER_EXECUTOR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong as it will fail if the code is instrumented. You'll need to use _Py_GetBaseCodeUnit()
next_instr->op.code == STORE_FASTfailed in_PyEval_EvalFrameDefault#143820