Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Modules/_testinternalcapi/test_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,7 @@ dummy_func(
#if TIER_ONE
assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE ||
Copy link
Copy Markdown
Member

@markshannon markshannon Apr 30, 2026

Choose a reason for hiding this comment

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

I'm not sure there's much value in this assert any more.
I'd be fine with removing the whole thing.

If you want to keep the check, this

Suggested change
assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE ||
#if TIER_ONE && defined(Py_DEBUG)
if (!PyStackRef_IsNone(frame->f_executable)) {
int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), frame->instr_ptr - _PyFrame_GetBytecode(frame)).op.code;
assert(opcode == SEND || opcode == FOR_ITER);
}
#endif

is probably a better formulation as it catches errors that would be hidden behind instrumentation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok, I updated my PR to use _Py_GetBaseCodeUnit().

frame->instr_ptr->op.code == INSTRUMENTED_INSTRUCTION ||
frame->instr_ptr->op.code == INSTRUMENTED_FOR_ITER ||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND ||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER ||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT ||
Expand Down
1 change: 1 addition & 0 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading