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 "Python.h"
|
||||||
#include "pycore_abstract.h" // _PyIndex_Check()
|
#include "pycore_abstract.h" // _PyIndex_Check()
|
||||||
#include "pycore_call.h" // _PyObject_FastCallDictTstate()
|
#include "pycore_call.h" // _PyObject_FastCallDictTstate()
|
||||||
@ -4003,13 +4011,14 @@ dummy_func(
|
|||||||
// END BYTECODES //
|
// END BYTECODES //
|
||||||
|
|
||||||
}
|
}
|
||||||
error:;
|
error:
|
||||||
exception_unwind:;
|
exception_unwind:
|
||||||
handle_eval_breaker:;
|
handle_eval_breaker:
|
||||||
resume_frame:;
|
resume_frame:
|
||||||
resume_with_error:;
|
resume_with_error:
|
||||||
start_frame:;
|
start_frame:
|
||||||
unbound_local_error:;
|
unbound_local_error:
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Families go below this point //
|
// 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!
|
// Do not edit!
|
||||||
|
|
||||||
TARGET(NOP) {
|
TARGET(NOP) {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import io
|
import io
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
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):
|
for target in re.findall(r"(?:PREDICT|GO_TO_INSTRUCTION)\((\w+)\)", inst.block.text):
|
||||||
predictions.add(target)
|
predictions.add(target)
|
||||||
indent = " "
|
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")
|
f.write("// Do not edit!\n")
|
||||||
for instr in instrs:
|
for instr in instrs:
|
||||||
assert isinstance(instr, InstDef)
|
assert isinstance(instr, InstDef)
|
||||||
|
Loading…
Reference in New Issue
Block a user