mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00
gh-101928: fix crash in compiler on multi-line lambda in function call (#101933)
This commit is contained in:
parent
0b13575e74
commit
df7ccf6138
2 changed files with 13 additions and 2 deletions
|
@ -1155,6 +1155,17 @@ if 1:
|
||||||
with self.subTest(expr=expr):
|
with self.subTest(expr=expr):
|
||||||
compile(expr, "<single>", "exec")
|
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()
|
@requires_debug_ranges()
|
||||||
class TestSourcePositions(unittest.TestCase):
|
class TestSourcePositions(unittest.TestCase):
|
||||||
|
|
|
@ -9085,8 +9085,8 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts)
|
||||||
Py_DECREF(cnt);
|
Py_DECREF(cnt);
|
||||||
break;
|
break;
|
||||||
case RETURN_VALUE:
|
case RETURN_VALUE:
|
||||||
INSTR_SET_OP1(inst, RETURN_CONST, oparg);
|
INSTR_SET_OP0(inst, NOP);
|
||||||
INSTR_SET_OP0(&bb->b_instr[i + 1], NOP);
|
INSTR_SET_OP1(&bb->b_instr[++i], RETURN_CONST, oparg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue