summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-11-30 11:03:30 (GMT)
committerGitHub <noreply@github.com>2023-11-30 11:03:30 (GMT)
commit07ebd46f9e55ed2f18c5ea2a79ec5054bc26b915 (patch)
treecfa482ec8e6e8f5dd4b77804a668235aa1ae9ccf /Lib/test
parent7eeea13403882af63a71226433c9a13b80c22564 (diff)
downloadcpython-07ebd46f9e55ed2f18c5ea2a79ec5054bc26b915.zip
cpython-07ebd46f9e55ed2f18c5ea2a79ec5054bc26b915.tar.gz
cpython-07ebd46f9e55ed2f18c5ea2a79ec5054bc26b915.tar.bz2
gh-112519: Make it possible to specify instruction flags for pseudo instructions in bytecodes.c (#112520)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_generated_cases.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/Lib/test/test_generated_cases.py b/Lib/test/test_generated_cases.py
index 98a8fff..de96a87 100644
--- a/Lib/test/test_generated_cases.py
+++ b/Lib/test/test_generated_cases.py
@@ -466,6 +466,44 @@ class TestGeneratedCases(unittest.TestCase):
"""
self.run_cases_test(input, output)
+ def test_pseudo_instruction_no_flags(self):
+ input = """
+ pseudo(OP) = {
+ OP1,
+ };
+
+ inst(OP1, (--)) {
+ }
+ """
+ output = """
+ TARGET(OP1) {
+ frame->instr_ptr = next_instr;
+ next_instr += 1;
+ INSTRUCTION_STATS(OP1);
+ DISPATCH();
+ }
+ """
+ self.run_cases_test(input, output)
+
+ def test_pseudo_instruction_with_flags(self):
+ input = """
+ pseudo(OP, (HAS_ARG, HAS_JUMP)) = {
+ OP1,
+ };
+
+ inst(OP1, (--)) {
+ }
+ """
+ output = """
+ TARGET(OP1) {
+ frame->instr_ptr = next_instr;
+ next_instr += 1;
+ INSTRUCTION_STATS(OP1);
+ DISPATCH();
+ }
+ """
+ self.run_cases_test(input, output)
+
def test_array_input(self):
input = """
inst(OP, (below, values[oparg*2], above --)) {