https://github.com/python/cpython/commit/c8fd4b12e3db49d795de55f74d9bac445c059f1b
commit: c8fd4b12e3db49d795de55f74d9bac445c059f1b
branch: main
author: Michael Droettboom <[email protected]>
committer: mdboom <[email protected]>
date: 2024-10-18T15:51:29-04:00
summary:

gh-125207: Fix MSVC 1935 build with JIT (#125209)

* gh-125207: Use {0} array initializers

* Simplify, as suggested in PR

* Revert change to explicitly specify length

files:
M Python/jit.c
M Tools/jit/_stencils.py
M Tools/jit/_writer.py

diff --git a/Python/jit.c b/Python/jit.c
index 234fc7dda83231..963bde2303dc2c 100644
--- a/Python/jit.c
+++ b/Python/jit.c
@@ -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;
diff --git a/Tools/jit/_stencils.py b/Tools/jit/_stencils.py
index bbb52f391f4b01..e4b2bf6e4702b3 100644
--- a/Tools/jit/_stencils.py
+++ b/Tools/jit/_stencils.py
@@ -339,7 +339,7 @@ def _get_trampoline_mask(self) -> str:
             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."""
diff --git a/Tools/jit/_writer.py b/Tools/jit/_writer.py
index 7b99d10310a645..4e7f614b0e9d23 100644
--- a/Tools/jit/_writer.py
+++ b/Tools/jit/_writer.py
@@ -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 "};"
 
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to