Skip to content

Conversation

@gaogaotiantian
Copy link
Member

@gaogaotiantian gaogaotiantian commented May 7, 2024

There is an assertion introduced in YIELD_VALUE to check the opcode. However, when the line is being traced, the opcode would be INSTRUMENTED_LINE or INSTRUMENTED_INSTRUCTION and _PyOpcode_Deopt won't convert it back.

We can be more precise here to get the exact base opcode of the instruction, but that would probably introduce extra code outside of the assertion (the code object and the index is needed).

I think in this case, adding the two instrumentation opcode is good enough because the assertion is well covered in non-tracing mode.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! I'll merge now so the quality of beta 1 is epsilon higher.

@gvanrossum gvanrossum merged commit 0d91488 into python:main May 7, 2024
@gaogaotiantian gaogaotiantian deleted the fix-yield-assertion branch May 7, 2024 04:24
@gaogaotiantian
Copy link
Member Author

Thanks for the quick review!

SonicField pushed a commit to SonicField/cpython that referenced this pull request May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants