]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-125207: Fix MSVC 1935 build with JIT (#125209)
authorMichael Droettboom <mdboom@gmail.com>
Fri, 18 Oct 2024 19:51:29 +0000 (15:51 -0400)
committerGitHub <noreply@github.com>
Fri, 18 Oct 2024 19:51:29 +0000 (15:51 -0400)
* gh-125207: Use {0} array initializers

* Simplify, as suggested in PR

* Revert change to explicitly specify length

Python/jit.c
Tools/jit/_stencils.py
Tools/jit/_writer.py

index 234fc7dda832311889a5756042fef8f7b5146d70..963bde2303dc2cba3b4bdb729ea7e29193e5259a 100644 (file)
@@ -469,7 +469,7 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction trace[], siz
     // Loop once to find the total compiled size:
     size_t code_size = 0;
     size_t data_size = 0;
-    jit_state state = {};
+    jit_state state = {0};
     group = &trampoline;
     code_size += group->code_size;
     data_size += group->data_size;
index bbb52f391f4b01abfc9e838ff22f6a1e8b3aa1f1..e4b2bf6e4702b380940ffe104fe0cccad32ed745 100644 (file)
@@ -339,7 +339,7 @@ class StencilGroup:
             word = bitmask & ((1 << 32) - 1)
             trampoline_mask.append(f"{word:#04x}")
             bitmask >>= 32
-        return "{" + ", ".join(trampoline_mask) + "}"
+        return "{" + (", ".join(trampoline_mask) or "0") + "}"
 
     def as_c(self, opname: str) -> str:
         """Dump this hole as a StencilGroup initializer."""
index 7b99d10310a645e9bf2eb61a0d93327514160359..4e7f614b0e9d2328b12ef9cb3287ea94207793bd 100644 (file)
@@ -32,8 +32,11 @@ def _dump_footer(
     yield "};"
     yield ""
     yield f"static const void * const symbols_map[{max(len(symbols), 1)}] = {{"
-    for symbol, ordinal in symbols.items():
-        yield f"    [{ordinal}] = &{symbol},"
+    if symbols:
+        for symbol, ordinal in symbols.items():
+            yield f"    [{ordinal}] = &{symbol},"
+    else:
+        yield "    0"
     yield "};"