Commit graph

2 commits

Author SHA1 Message Date
kigland
19f39a00a4 Add generator close regression test 2026-06-08 11:57:40 -07:00
kigland
d5257380b2 Guard against f_lasti == -1 when detecting exception returns
The tracer reads co_code[frame.f_lasti] to decide whether a 'return' event was
caused by an exception. f_lasti can be -1 (e.g. a frame that hasn't executed
an instruction), and co_code[-1] reads the last byte -- the wrong opcode --
which can misreport a normal return as "Call ended by exception". Extract the
check into call_ended_by_exception() and return False when f_lasti < 0.
2026-06-08 11:57:40 -07:00