]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-99104: Update headers for bytecodes.c and generate_cases.py (#99112)
authorGuido van Rossum <guido@python.org>
Sat, 5 Nov 2022 00:40:43 +0000 (17:40 -0700)
committerGitHub <noreply@github.com>
Sat, 5 Nov 2022 00:40:43 +0000 (17:40 -0700)
Also tweak the labels near the end of bytecodes.c.

Python/bytecodes.c
Python/generated_cases.c.h
Tools/cases_generator/generate_cases.py

index 16ac1d9d2e95acd00fd543f8d77910d98d6a453f..e87ca6ebe8a0519dc77d3199e77137c998f8ce19 100644 (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 //
index bea51d7e5160dc5e9254f2fa1f9c277d072b970d..c678de5dff335b40edb417aec9a92cfdda5b455e 100644 (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) {
index 82e58017d64836425098589574d1168790c151e7..ec2481b31b9fd6a470ebc646b378ea61505f3262 100644 (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)