diff --git a/Modules/_testexternalinspection.c b/Modules/_testexternalinspection.c index 25e0e9c64ec27d..0959b82f65ce3c 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) {