GH-99104: Update headers for bytecodes.c and generate_cases.py (#99112)

Also tweak the labels near the end of bytecodes.c.
This commit is contained in:
Guido van Rossum 2022-11-04 17:40:43 -07:00 committed by GitHub
parent 6a8d3c57af
commit d04899abb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 9 deletions

View File

@ -1,3 +1,11 @@
// 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()
@ -4003,13 +4011,14 @@ dummy_func(
// 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 //

View File

@ -1,4 +1,4 @@
// This file is generated by Tools/scripts/generate_cases.py
// This file is generated by Tools/cases_generator/generate_cases.py
// Do not edit!
TARGET(NOP) {

View File

@ -6,6 +6,7 @@
import argparse
import io
import os
import re
import sys
@ -67,7 +68,7 @@ def write_cases(f: io.TextIOBase, instrs: list[InstDef]):
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)