Skip to content

Commit 51618b6

Browse files
committed
gh-125207: Use {0} array initializers
1 parent f2cb399 commit 51618b6

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

Python/jit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction trace[], siz
469469
// Loop once to find the total compiled size:
470470
size_t code_size = 0;
471471
size_t data_size = 0;
472-
jit_state state = {};
472+
jit_state state = {0};
473473
group = &trampoline;
474474
code_size += group->code_size;
475475
data_size += group->data_size;

Tools/jit/_stencils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,10 @@ def _get_trampoline_mask(self) -> str:
339339
word = bitmask & ((1 << 32) - 1)
340340
trampoline_mask.append(f"{word:#04x}")
341341
bitmask >>= 32
342-
return "{" + ", ".join(trampoline_mask) + "}"
342+
if len(trampoline_mask):
343+
return "{" + ", ".join(trampoline_mask) + "}"
344+
else:
345+
return "{0}"
343346

344347
def as_c(self, opname: str) -> str:
345348
"""Dump this hole as a StencilGroup initializer."""

Tools/jit/_writer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ def _dump_footer(
3232
yield "};"
3333
yield ""
3434
yield f"static const void * const symbols_map[{max(len(symbols), 1)}] = {{"
35-
for symbol, ordinal in symbols.items():
36-
yield f" [{ordinal}] = &{symbol},"
35+
if len(symbols):
36+
for symbol, ordinal in symbols.items():
37+
yield f" [{ordinal}] = &{symbol},"
38+
else:
39+
yield " 0"
3740
yield "};"
3841

3942

0 commit comments

Comments
 (0)