Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Lib/test/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,17 @@ def test_if_expression_expression_empty_block(self):
with self.subTest(expr=expr):
compile(expr, "<single>", "exec")

def test_multi_line_lambda_as_argument(self):
# See gh-101928
compile("""
def foo(param, lambda_exp):
pass

foo(param=0,
lambda_exp=lambda:
1)
""", "<test>", "exec")


@requires_debug_ranges()
class TestSourcePositions(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -9085,8 +9085,8 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts)
Py_DECREF(cnt);
break;
case RETURN_VALUE:
INSTR_SET_OP1(inst, RETURN_CONST, oparg);
INSTR_SET_OP0(&bb->b_instr[i + 1], NOP);
INSTR_SET_OP0(inst, NOP);
INSTR_SET_OP1(&bb->b_instr[++i], RETURN_CONST, oparg);
break;
}
break;
Expand Down