mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-109923: set line number on the POP_TOP that follows a RETURN_GENERATOR (#109924)
This commit is contained in:
parent
b89ed9df39
commit
ea285ad8b6
3 changed files with 9 additions and 12 deletions
|
@ -2468,17 +2468,19 @@ insert_prefix_instructions(_PyCompile_CodeUnitMetadata *umd, basicblock *entrybl
|
|||
* of 0. This is because RETURN_GENERATOR pushes an element
|
||||
* with _PyFrame_StackPush before switching stacks.
|
||||
*/
|
||||
|
||||
location loc = LOCATION(umd->u_firstlineno, umd->u_firstlineno, -1, -1);
|
||||
cfg_instr make_gen = {
|
||||
.i_opcode = RETURN_GENERATOR,
|
||||
.i_oparg = 0,
|
||||
.i_loc = LOCATION(umd->u_firstlineno, umd->u_firstlineno, -1, -1),
|
||||
.i_loc = loc,
|
||||
.i_target = NULL,
|
||||
};
|
||||
RETURN_IF_ERROR(basicblock_insert_instruction(entryblock, 0, &make_gen));
|
||||
cfg_instr pop_top = {
|
||||
.i_opcode = POP_TOP,
|
||||
.i_oparg = 0,
|
||||
.i_loc = NO_LOCATION,
|
||||
.i_loc = loc,
|
||||
.i_target = NULL,
|
||||
};
|
||||
RETURN_IF_ERROR(basicblock_insert_instruction(entryblock, 1, &pop_top));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue