Skip to content
Prev Previous commit
Next Next commit
Set exception only if not set
  • Loading branch information
sergey-miryanov committed Apr 25, 2025
commit cc46cc28d9d20ae5180e3d8e69583a1afe5e6dc0
4 changes: 3 additions & 1 deletion Python/remote_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ search_map_for_section(proc_handle_t *handle, const char* secname, const char* s

mach_port_t proc_ref = pid_to_task(handle->pid);
if (proc_ref == 0) {
PyErr_SetString(PyExc_PermissionError, "Cannot get task for PID");
if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_PermissionError, "Cannot get task for PID");
}
return 0;
}

Expand Down