]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] GH-130673: Gracefully handle missing sections in JIT build (GH-131749)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 8 Apr 2025 02:16:23 +0000 (04:16 +0200)
committerGitHub <noreply@github.com>
Tue, 8 Apr 2025 02:16:23 +0000 (19:16 -0700)
(cherry picked from commit a26a301f8b09c1825b288fc8649f8174576361f4)
Co-authored-by: Bojun Ren <bj.ren.coding@outlook.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Misc/NEWS.d/next/Build/2025-03-06-20-55-34.gh-issue-130673.T3RSCI.rst [new file with mode: 0644]
Tools/jit/_targets.py
Tools/jit/ignore-tests-emulated-linux.txt

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 (file)
index 0000000..20c52c3
--- /dev/null
@@ -0,0 +1,2 @@
+Fix potential ``KeyError`` when handling object sections during JIT building
+process.
index cebfad5a7467d24e40d5ce6925e2efc4d13cd5a1..50b5d923a355ce8f1cbe61d95b666351fc93b1d0 100644 (file)
@@ -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:
index dbb364673b5c1abaaacc8a48669d727e28e8375e..ca51b75f07f1ec8f9184813e91c9d7ae09a7cac4 100644 (file)
@@ -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