GH-118093: Improve handling of short and mid-loop traces (GH-122252)

This commit is contained in:
Brandt Bucher 2024-07-29 14:49:17 -07:00 committed by GitHub
parent 78df1043db
commit 7797182b78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 35 deletions

View file

@ -342,8 +342,9 @@ _PyGen_yf(PyGenObject *gen)
{
if (gen->gi_frame_state == FRAME_SUSPENDED_YIELD_FROM) {
_PyInterpreterFrame *frame = &gen->gi_iframe;
assert(is_resume(frame->instr_ptr));
assert((frame->instr_ptr->op.arg & RESUME_OPARG_LOCATION_MASK) >= RESUME_AFTER_YIELD_FROM);
// GH-122390: These asserts are wrong in the presence of ENTER_EXECUTOR!
// assert(is_resume(frame->instr_ptr));
// assert((frame->instr_ptr->op.arg & RESUME_OPARG_LOCATION_MASK) >= RESUME_AFTER_YIELD_FROM);
return PyStackRef_AsPyObjectNew(_PyFrame_StackPeek(frame));
}
return NULL;