mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
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:
parent
6a8d3c57af
commit
d04899abb0
@ -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 //
|
||||
|
2
Python/generated_cases.c.h
generated
2
Python/generated_cases.c.h
generated
@ -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) {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user