mirror of
https://github.com/python/cpython.git
synced 2025-09-10 18:58:35 +00:00
GH-131498: Cases generator: Allow input and 'peek' variables to be modified (GH-132506)
This commit is contained in:
parent
be763e550e
commit
844596c09f
9 changed files with 90 additions and 116 deletions
|
@ -1862,13 +1862,28 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
|
||||
def test_reassigning_live_inputs(self):
|
||||
input = """
|
||||
inst(OP, (in -- )) {
|
||||
inst(OP, (in -- in)) {
|
||||
in = 0;
|
||||
DEAD(in);
|
||||
}
|
||||
"""
|
||||
with self.assertRaises(SyntaxError):
|
||||
self.run_cases_test(input, "")
|
||||
|
||||
output = """
|
||||
TARGET(OP) {
|
||||
#if Py_TAIL_CALL_INTERP
|
||||
int opcode = OP;
|
||||
(void)(opcode);
|
||||
#endif
|
||||
frame->instr_ptr = next_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(OP);
|
||||
_PyStackRef in;
|
||||
in = stack_pointer[-1];
|
||||
in = 0;
|
||||
stack_pointer[-1] = in;
|
||||
DISPATCH();
|
||||
}
|
||||
"""
|
||||
self.run_cases_test(input, output)
|
||||
|
||||
def test_reassigning_dead_inputs(self):
|
||||
input = """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue