@@ -7528,17 +7528,15 @@ build_cellfixedoffsets(_PyCompile_CodeUnitMetadata *umd)
7528
7528
}
7529
7529
7530
7530
static int
7531
- insert_prefix_instructions (_PyCompile_CodeUnitMetadata * umd , basicblock * entryblock ,
7531
+ insert_prefix_instructions (_PyCompile_CodeUnitMetadata * umd , cfg_builder * g ,
7532
7532
int * fixed , int nfreevars , int code_flags )
7533
7533
{
7534
+ basicblock * entryblock = g -> g_entryblock ;
7534
7535
assert (umd -> u_firstlineno > 0 );
7535
7536
7536
7537
/* Add the generator prefix instructions. */
7537
7538
if (code_flags & (CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR )) {
7538
- /* Note that RETURN_GENERATOR + POP_TOP have a net stack effect
7539
- * of 0. This is because RETURN_GENERATOR pushes an element
7540
- * with _PyFrame_StackPush before switching stacks.
7541
- */
7539
+ g -> g_maxdepth ++ ; /* make space for the value pushed by RETURN_GENERATOR */
7542
7540
cfg_instr make_gen = {
7543
7541
.i_opcode = RETURN_GENERATOR ,
7544
7542
.i_oparg = 0 ,
@@ -7669,7 +7667,7 @@ prepare_localsplus(_PyCompile_CodeUnitMetadata *umd, cfg_builder *g, int code_fl
7669
7667
7670
7668
7671
7669
// This must be called before fix_cell_offsets().
7672
- if (insert_prefix_instructions (umd , g -> g_entryblock , cellfixedoffsets , nfreevars , code_flags )) {
7670
+ if (insert_prefix_instructions (umd , g , cellfixedoffsets , nfreevars , code_flags )) {
7673
7671
PyMem_Free (cellfixedoffsets );
7674
7672
return ERROR ;
7675
7673
}
0 commit comments