From be98fda7c6698e8468afd528c864aca1f532af59 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 25 Jan 2025 18:19:48 +0100 Subject: [PATCH] gh-129223: Raise KeyError in search_map_for_section() if not found (#129262) --- Modules/_testexternalinspection.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/_testexternalinspection.c b/Modules/_testexternalinspection.c index 24adb63cbed2..5a28c0e26622 100644 --- a/Modules/_testexternalinspection.c +++ b/Modules/_testexternalinspection.c @@ -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) { -- 2.47.3