From: Victor Stinner Date: Sat, 25 Jan 2025 17:19:48 +0000 (+0100) Subject: gh-129223: Raise KeyError in search_map_for_section() if not found (#129262) X-Git-Tag: v3.14.0a5~237 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be98fda7c6698e8468afd528c864aca1f532af59;p=thirdparty%2FPython%2Fcpython.git gh-129223: Raise KeyError in search_map_for_section() if not found (#129262) --- 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) {