8000 Fix Windows? · python/cpython@d33cc95 · GitHub
[go: up one dir, main page]

Skip to content

Commit d33cc95

Browse files
committed
Fix Windows?
1 parent e0a69d1 commit d33cc95

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Tools/jit/build.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,11 @@ def dump(stencils: dict[str, Stencil]) -> typing.Generator[str, None, None]:
727727
for line in stencil.disassembly_data:
728728
yield f"// {line}"
729729
body = ", ".join(f"0x{byte:02x}" for byte in stencil.data)
730-
yield f"static const unsigned char {opname}_stencil_bytes_data[{len(stencil.data)}] = {{{body}}};"
731-
if stencil.holes:
730+
if stencil.data:
731+
yield f"static const unsigned char {opname}_stencil_bytes_data[{len(stencil.data) + 1}] = {{{body}}};"
732+
else:
733+
yield f"static const unsigned char {opname}_stencil_bytes_data[1];"
734+
if stencil.holes_data:
732735
yield f"static const Hole {opname}_stencil_holes_data[{len(stencil.holes_data) + 1}] = {{"
733736
for hole in sorted(stencil.holes_data, key=lambda hole: hole.offset):
734737
parts = [
@@ -747,7 +750,7 @@ def dump(stencils: dict[str, Stencil]) -> typing.Generator[str, None, None]:
747750
yield f" .bytes = OP##_stencil_bytes, \\"
748751
yield f" .nholes = Py_ARRAY_LENGTH(OP##_stencil_holes) - 1, \\"
749752
yield f" .holes = OP##_stencil_holes, \\"
750-
yield f" .nbytes_data = Py_ARRAY_LENGTH(OP##_stencil_bytes_data), \\"
753+
yield f" .nbytes_data = Py_ARRAY_LENGTH(OP##_stencil_bytes_data) - 1, \\"
751754
yield f" .bytes_data = OP##_stencil_bytes_data, \\"
752755
yield f" .nholes_data = Py_ARRAY_LENGTH(OP##_stencil_holes_data) - 1, \\"
753756
yield f" .holes_data = OP##_stencil_holes_data, \\"

0 commit comments

Comments
 (0)
0