From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 8 Apr 2025 02:16:23 +0000 (+0200) Subject: [3.13] GH-130673: Gracefully handle missing sections in JIT build (GH-131749) X-Git-Tag: v3.13.3~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bde72839d76d0b52f0f1753920cc88f723df340a;p=thirdparty%2FPython%2Fcpython.git [3.13] GH-130673: Gracefully handle missing sections in JIT build (GH-131749) (cherry picked from commit a26a301f8b09c1825b288fc8649f8174576361f4) Co-authored-by: Bojun Ren Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- 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 000000000000..20c52c3e3722 --- /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 cebfad5a7467..50b5d923a355 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -330,7 +330,11 @@ class _ELF( 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: diff --git a/Tools/jit/ignore-tests-emulated-linux.txt b/Tools/jit/ignore-tests-emulated-linux.txt index dbb364673b5c..ca51b75f07f1 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