Skip to content

Commit 0b50439

Browse files
rennsaxseehwan80
authored andcommitted
pythonGH-130673: Gracefully handle missing sections in JIT build (pythonGH-130906)
1 parent 04c2781 commit 0b50439

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix potential ``KeyError`` when handling object sections during JIT building
2+
process.

Tools/jit/_targets.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,11 @@ def _handle_section(
323323
if section_type == "SHT_RELA":
324324
assert "SHF_INFO_LINK" in flags, flags
325325
assert not section["Symbols"]
326-
value, base = group.symbols[section["Info"]]
326+
maybe_symbol = group.symbols.get(section["Info"])
327+
if maybe_symbol is None:
328+
# These are relocations for a section we're not emitting. Skip:
329+
return
330+
value, base = maybe_symbol
327331
if value is _stencils.HoleValue.CODE:
328332
stencil = group.code
329333
else:

0 commit comments

Comments
 (0)