summaryrefslogtreecommitdiffstats
path: root/Tools/cases_generator/generate_cases.py
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-01-25 22:29:56 (GMT)
committerGitHub <noreply@github.com>2023-01-25 22:29:56 (GMT)
commitb400219df5f245ef2eb3c7ce0589b1f8020a1192 (patch)
tree6ce0e7cf8c039cf5c5f2f573c7f6060c329cdc35 /Tools/cases_generator/generate_cases.py
parent6162a0e305faf82534c011ddb2fb99a94ae84d29 (diff)
downloadcpython-b400219df5f245ef2eb3c7ce0589b1f8020a1192.zip
cpython-b400219df5f245ef2eb3c7ce0589b1f8020a1192.tar.gz
cpython-b400219df5f245ef2eb3c7ce0589b1f8020a1192.tar.bz2
gh-98831: rewrite RAISE_VARARGS in the instruction definition DSL (#101306)
Diffstat (limited to 'Tools/cases_generator/generate_cases.py')
-rw-r--r--Tools/cases_generator/generate_cases.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py
index 3e2ddaa..b794241 100644
--- a/Tools/cases_generator/generate_cases.py
+++ b/Tools/cases_generator/generate_cases.py
@@ -774,7 +774,8 @@ class Analyzer:
pushed_data.append( (instr, pushed) )
def write_function(direction: str, data: list[tuple[Instruction, str]]) -> None:
- self.out.emit("\nstatic int");
+ self.out.emit("\n#ifndef NDEBUG");
+ self.out.emit("static int");
self.out.emit(f"_PyOpcode_num_{direction}(int opcode, int oparg) {{")
self.out.emit(" switch(opcode) {");
for instr, effect in data:
@@ -784,6 +785,7 @@ class Analyzer:
self.out.emit(" Py_UNREACHABLE();")
self.out.emit(" }")
self.out.emit("}")
+ self.out.emit("#endif");
write_function('popped', popped_data)
write_function('pushed', pushed_data)
@@ -1023,7 +1025,7 @@ def always_exits(lines: list[str]) -> bool:
return False
line = line[12:]
return line.startswith(
- ("goto ", "return ", "DISPATCH", "GO_TO_", "Py_UNREACHABLE()")
+ ("goto ", "return ", "DISPATCH", "GO_TO_", "Py_UNREACHABLE()", "ERROR_IF(true, ")
)