gh-101907: Stop using _Py_OPCODE and _Py_OPARG macros (GH-101912)

* gh-101907: Removes use of non-standard C++ extension from Include/cpython/code.h

* Make cases_generator correct on Windows
This commit is contained in:
Steve Dower 2023-02-20 14:56:48 +00:00 committed by GitHub
parent c00faf7943
commit a99eb5cd99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 200 additions and 184 deletions

View file

@ -8,6 +8,7 @@ import argparse
import contextlib
import dataclasses
import os
import posixpath
import re
import sys
import typing
@ -17,7 +18,7 @@ from parser import StackEffect
HERE = os.path.dirname(__file__)
ROOT = os.path.join(HERE, "../..")
THIS = os.path.relpath(__file__, ROOT)
THIS = os.path.relpath(__file__, ROOT).replace(os.path.sep, posixpath.sep)
DEFAULT_INPUT = os.path.relpath(os.path.join(ROOT, "Python/bytecodes.c"))
DEFAULT_OUTPUT = os.path.relpath(os.path.join(ROOT, "Python/generated_cases.c.h"))
@ -930,7 +931,7 @@ class Analyzer:
with open(self.metadata_filename, "w") as f:
# Write provenance header
f.write(f"// This file is generated by {THIS} --metadata\n")
f.write(f"// from {os.path.relpath(self.filename, ROOT)}\n")
f.write(f"// from {os.path.relpath(self.filename, ROOT).replace(os.path.sep, posixpath.sep)}\n")
f.write(f"// Do not edit!\n")
# Create formatter; the rest of the code uses this
@ -1009,7 +1010,7 @@ class Analyzer:
with open(self.output_filename, "w") as f:
# Write provenance header
f.write(f"// This file is generated by {THIS}\n")
f.write(f"// from {os.path.relpath(self.filename, ROOT)}\n")
f.write(f"// from {os.path.relpath(self.filename, ROOT).replace(os.path.sep, posixpath.sep)}\n")
f.write(f"// Do not edit!\n")
# Create formatter; the rest of the code uses this