From 2745aa4c910f3f3e27aed40da475743377e1c1c3 Mon Sep 17 00:00:00 2001 From: Bojun Ren Date: Wed, 26 Mar 2025 07:35:39 +0800 Subject: [PATCH 1/2] GH-130673: Gracefully handle missing sections in JIT build (GH-130906) (cherry picked from commit a26a301f8b09c1825b288fc8649f8174576361f4) Co-authored-by: Bojun Ren --- .../Build/2025-03-06-20-55-34.gh-issue-130673.T3RSCI.rst | 2 ++ Tools/jit/_targets.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Build/2025-03-06-20-55-34.gh-issue-130673.T3RSCI.rst diff --git a/Misc/NEWS.d/next/Build/2025-03-06-20-55-34.gh-issue-130673.T3RSCI.rst b/Misc/NEWS.d/next/Build/2025-03-06-20-55-34.gh-issue-130673.T3RSCI.rst new file mode 100644 index 00000000000000..20c52c3e3722b2 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-03-06-20-55-34.gh-issue-130673.T3RSCI.rst @@ -0,0 +1,2 @@ +Fix potential ``KeyError`` when handling object sections during JIT building +process. diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py index cebfad5a7467d2..50b5d923a355ce 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -330,7 +330,11 @@ def _handle_section( if section_type == "SHT_RELA": assert "SHF_INFO_LINK" in flags, flags assert not section["Symbols"] - value, base = group.symbols[section["Info"]] + maybe_symbol = group.symbols.get(section["Info"]) + if maybe_symbol is None: + # These are relocations for a section we're not emitting. Skip: + return + value, base = maybe_symbol if value is _stencils.HoleValue.CODE: stencil = group.code else: From 0256e988fb5c39a5a58a9f9b3d174cfb936dea76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sun, 6 Apr 2025 10:24:17 +0200 Subject: [PATCH 2/2] ignore `test.test_posix.PosixTester.test_fexecve` --- Tools/jit/ignore-tests-emulated-linux.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Tools/jit/ignore-tests-emulated-linux.txt b/Tools/jit/ignore-tests-emulated-linux.txt index dbb364673b5c1a..ca51b75f07f1ec 100644 --- a/Tools/jit/ignore-tests-emulated-linux.txt +++ b/Tools/jit/ignore-tests-emulated-linux.txt @@ -25,6 +25,7 @@ test.test_pathlib.PosixPathTest.test_is_mount_root test.test_pathlib.test_pathlib.PathSubclassTest.test_is_mount_root test.test_pathlib.test_pathlib.PathTest.test_is_mount_root test.test_pathlib.test_pathlib.PosixPathTest.test_is_mount_root +test.test_posix.PosixTester.test_fexecve test.test_posix.TestPosixSpawn.test_close_file test.test_posix.TestPosixSpawnP.test_close_file test.test_posixpath.PosixPathTest.test_ismount