Skip to content

Commit bde7283

Browse files
miss-islingtonrennsaxpicnixz
authored
[3.13] GH-130673: Gracefully handle missing sections in JIT build (GH-131749)
(cherry picked from commit a26a301) Co-authored-by: Bojun Ren <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]>
1 parent ac9d7c6 commit bde7283

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed
Lines changed: 2 additions & 0 deletions
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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,11 @@ def _handle_section(
330330
if section_type == "SHT_RELA":
331331
assert "SHF_INFO_LINK" in flags, flags
332332
assert not section["Symbols"]
333-
value, base = group.symbols[section["Info"]]
333+
maybe_symbol = group.symbols.get(section["Info"])
334+
if maybe_symbol is None:
335+
# These are relocations for a section we're not emitting. Skip:
336+
return
337+
value, base = maybe_symbol
334338
if value is _stencils.HoleValue.CODE:
335339
stencil = group.code
336340
else:

Tools/jit/ignore-tests-emulated-linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ test.test_pathlib.PosixPathTest.test_is_mount_root
2525
test.test_pathlib.test_pathlib.PathSubclassTest.test_is_mount_root
2626
test.test_pathlib.test_pathlib.PathTest.test_is_mount_root
2727
test.test_pathlib.test_pathlib.PosixPathTest.test_is_mount_root
28+
test.test_posix.PosixTester.test_fexecve
2829
test.test_posix.TestPosixSpawn.test_close_file
2930
test.test_posix.TestPosixSpawnP.test_close_file
3031
test.test_posixpath.PosixPathTest.test_ismount

0 commit comments

Comments
 (0)