Skip to content

Commit d04899a

Browse files
authored
GH-99104: Update headers for bytecodes.c and generate_cases.py (#99112)
Also tweak the labels near the end of bytecodes.c.
1 parent 6a8d3c5 commit d04899a

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

Python/bytecodes.c

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
// This file contains instruction definitions.
2+
// It is read by Tools/cases_generator/generate_cases.py
3+
// to generate Python/generated_cases.c.h.
4+
// Note that there is some dummy C code at the top and bottom of the file
5+
// to fool text editors like VS Code into believing this is valid C code.
6+
// The actual instruction definitions start at // BEGIN BYTECODES //.
7+
// See Tools/cases_generator/README.md for more information.
8+
19
#include "Python.h"
210
#include "pycore_abstract.h" // _PyIndex_Check()
311
#include "pycore_call.h" // _PyObject_FastCallDictTstate()
@@ -4003,13 +4011,14 @@ dummy_func(
40034011
// END BYTECODES //
40044012

40054013
}
4006-
error:;
4007-
exception_unwind:;
4008-
handle_eval_breaker:;
4009-
resume_frame:;
4010-
resume_with_error:;
4011-
start_frame:;
4012-
unbound_local_error:;
4014+
error:
4015+
exception_unwind:
4016+
handle_eval_breaker:
4017+
resume_frame:
4018+
resume_with_error:
4019+
start_frame:
4020+
unbound_local_error:
4021+
;
40134022
}
40144023

40154024
// Families go below this point //

Python/generated_cases.c.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/cases_generator/generate_cases.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import argparse
88
import io
9+
import os
910
import re
1011
import sys
1112

@@ -67,7 +68,7 @@ def write_cases(f: io.TextIOBase, instrs: list[InstDef]):
6768
for target in re.findall(r"(?:PREDICT|GO_TO_INSTRUCTION)\((\w+)\)", inst.block.text):
6869
predictions.add(target)
6970
indent = " "
70-
f.write("// This file is generated by Tools/scripts/generate_cases.py\n")
71+
f.write(f"// This file is generated by {os.path.relpath(__file__)}\n")
7172
f.write("// Do not edit!\n")
7273
for instr in instrs:
7374
assert isinstance(instr, InstDef)

0 commit comments

Comments
 (0)