]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-129223: Raise KeyError in search_map_for_section() if not found (#129262)
authorVictor Stinner <vstinner@python.org>
Sat, 25 Jan 2025 17:19:48 +0000 (18:19 +0100)
committerGitHub <noreply@github.com>
Sat, 25 Jan 2025 17:19:48 +0000 (18:19 +0100)
Modules/_testexternalinspection.c

index 24adb63cbed24cb858b164429beb6e7adc87faed..5a28c0e266226b0cc45fcf88f264f1319d54dab5 100644 (file)
@@ -383,6 +383,10 @@ search_map_for_section(pid_t pid, const char* secname, const char* map)
             );
         result = start_address + (uintptr_t)section->sh_addr - elf_load_addr;
     }
+    else {
+        PyErr_Format(PyExc_KeyError,
+                     "cannot find map for section %s", secname);
+    }
 
 exit:
     if (close(fd) != 0) {