+// This file contains instruction definitions.
+// It is read by Tools/cases_generator/generate_cases.py
+// to generate Python/generated_cases.c.h.
+// Note that there is some dummy C code at the top and bottom of the file
+// to fool text editors like VS Code into believing this is valid C code.
+// The actual instruction definitions start at // BEGIN BYTECODES //.
+// See Tools/cases_generator/README.md for more information.
+
#include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_call.h" // _PyObject_FastCallDictTstate()
// END BYTECODES //
}
- error:;
- exception_unwind:;
- handle_eval_breaker:;
- resume_frame:;
- resume_with_error:;
- start_frame:;
- unbound_local_error:;
+ error:
+ exception_unwind:
+ handle_eval_breaker:
+ resume_frame:
+ resume_with_error:
+ start_frame:
+ unbound_local_error:
+ ;
}
// Families go below this point //
import argparse
import io
+import os
import re
import sys
for target in re.findall(r"(?:PREDICT|GO_TO_INSTRUCTION)\((\w+)\)", inst.block.text):
predictions.add(target)
indent = " "
- f.write("// This file is generated by Tools/scripts/generate_cases.py\n")
+ f.write(f"// This file is generated by {os.path.relpath(__file__)}\n")
f.write("// Do not edit!\n")
for instr in instrs:
assert isinstance(instr, InstDef)