diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index d839893d2c657e..38b360bd1f74c6 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -1624,7 +1624,7 @@ def func(): INTERPRETER_FRAME = '10PhcP' else: INTERPRETER_FRAME = '9PhcP' - check(x, size('3PiccPP' + INTERPRETER_FRAME + 'P')) + check(x, size('3PiccPP' + INTERPRETER_FRAME + 'PP')) # function def func(): pass check(func, size('16Pi')) @@ -1641,7 +1641,7 @@ def bar(cls): check(bar, size('PP')) # generator def get_gen(): yield 1 - check(get_gen(), size('6P4c' + INTERPRETER_FRAME + 'P')) + check(get_gen(), size('6P4c' + INTERPRETER_FRAME + 'PP')) # iterator check(iter('abc'), size('lP')) # callable-iterator diff --git a/Programs/test_frozenmain.h b/Programs/test_frozenmain.h index c936622c020e3c..99b0fa48e01c8b 100644 --- a/Programs/test_frozenmain.h +++ b/Programs/test_frozenmain.h @@ -1,6 +1,6 @@ // Auto-generated by Programs/freeze_test_frozenmain.py unsigned char M_test_frozenmain[] = { - 227,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0, + 227,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0, 0,0,0,0,0,243,168,0,0,0,149,0,89,0,79,0, 70,0,111,0,89,0,79,0,70,1,111,1,88,2,31,0, 79,1,49,1,0,0,0,0,0,0,29,0,88,2,31,0, diff --git a/Python/compile.c b/Python/compile.c index cbfba7f493e07d..82db6749db207d 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1335,6 +1335,11 @@ optimize_and_assemble_code_unit(struct compiler_unit *u, PyObject *const_cache, goto error; } + /* Reserve an extra word on the stack to ensure there is space for uops to + pass at least one item on the stack to a subsequent uop. + */ + stackdepth++; + /** Assembly **/ co = _PyAssemble_MakeCodeObject(&u->u_metadata, const_cache, consts, stackdepth, &optimized_instrs, nlocalsplus,