From 18786cfd9a96a5a34b7bb190b13e8f0a6b9d5e89 Mon Sep 17 00:00:00 2001 From: Uxio Garcia Andrade Date: Fri, 1 Aug 2025 18:05:38 +0200 Subject: [PATCH 1/6] gh-137293: Print Exceptions in searching ELF File in Remote Debug --- Python/remote_debug.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Python/remote_debug.h b/Python/remote_debug.h index 5324a7aaa6f5e5..0134730aa751b5 100644 --- a/Python/remote_debug.h +++ b/Python/remote_debug.h @@ -732,6 +732,9 @@ search_linux_map_for_section(proc_handle_t *handle, const char* secname, const c if (retval) { break; } + if (PyErr_Occured()){ + PyErr_Clear(); + } } } From fc3649cffa363c89df4bc5b5035d1f11e2498de5 Mon Sep 17 00:00:00 2001 From: Uxio Garcia Andrade Date: Fri, 1 Aug 2025 18:10:55 +0200 Subject: [PATCH 2/6] gh-137293 print exception instead of clearing --- Python/remote_debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/remote_debug.h b/Python/remote_debug.h index 0134730aa751b5..814f36287ad235 100644 --- a/Python/remote_debug.h +++ b/Python/remote_debug.h @@ -732,8 +732,8 @@ search_linux_map_for_section(proc_handle_t *handle, const char* secname, const c if (retval) { break; } - if (PyErr_Occured()){ - PyErr_Clear(); + if (PyErr_Occurred()){ + PyErr_Print(); } } } From 8086288c86443b6fa41d7ba0f167020dfb10fc5a Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 20:31:32 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2025-08-01-20-31-30.gh-issue-137293.4x3JbV.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2025-08-01-20-31-30.gh-issue-137293.4x3JbV.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-08-01-20-31-30.gh-issue-137293.4x3JbV.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-08-01-20-31-30.gh-issue-137293.4x3JbV.rst new file mode 100644 index 00000000000000..9c75df36c9e70f --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-08-01-20-31-30.gh-issue-137293.4x3JbV.rst @@ -0,0 +1 @@ +Ignore Exceptions when searching ELF Files in remote debug since the file containing PyRuntime is the only one that matters. From 17b9d100507ef1acbc8aed8ded612014ec71e8f1 Mon Sep 17 00:00:00 2001 From: Uxio Garcia Andrade Date: Fri, 1 Aug 2025 22:32:03 +0200 Subject: [PATCH 4/6] gh-137293 clear exception --- Python/remote_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/remote_debug.h b/Python/remote_debug.h index 814f36287ad235..5dd56c13793a83 100644 --- a/Python/remote_debug.h +++ b/Python/remote_debug.h @@ -733,7 +733,7 @@ search_linux_map_for_section(proc_handle_t *handle, const char* secname, const c break; } if (PyErr_Occurred()){ - PyErr_Print(); + PyErr_Clear(); } } } From 86e73ebcbb35831b8dfdeef9c0f67b7626c2cd5b Mon Sep 17 00:00:00 2001 From: Uxio Garcia Andrade Date: Fri, 1 Aug 2025 23:23:52 +0200 Subject: [PATCH 5/6] gh-137293 remove exceptions in search_elf_file_for_section --- Python/remote_debug.h | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/Python/remote_debug.h b/Python/remote_debug.h index 5dd56c13793a83..b6a0472af75553 100644 --- a/Python/remote_debug.h +++ b/Python/remote_debug.h @@ -572,25 +572,16 @@ search_elf_file_for_section( int fd = open(elf_file, O_RDONLY); if (fd < 0) { - PyErr_Format(PyExc_OSError, - "Cannot open ELF file '%s' for section '%s' search: %s", - elf_file, secname, strerror(errno)); goto exit; } struct stat file_stats; if (fstat(fd, &file_stats) != 0) { - PyErr_Format(PyExc_OSError, - "Cannot get file size for ELF file '%s' during section '%s' search: %s", - elf_file, secname, strerror(errno)); goto exit; } file_memory = mmap(NULL, file_stats.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (file_memory == MAP_FAILED) { - PyErr_Format(PyExc_OSError, - "Cannot memory map ELF file '%s' (size: %lld bytes) for section '%s' search: %s", - elf_file, (long long)file_stats.st_size, secname, strerror(errno)); goto exit; } @@ -598,9 +589,6 @@ search_elf_file_for_section( // Validate ELF header if (elf_header->e_shstrndx >= elf_header->e_shnum) { - PyErr_Format(PyExc_RuntimeError, - "Invalid ELF file '%s': string table index %u >= section count %u", - elf_file, elf_header->e_shstrndx, elf_header->e_shnum); goto exit; } @@ -635,9 +623,6 @@ search_elf_file_for_section( } if (first_load_segment == NULL) { - PyErr_Format(PyExc_RuntimeError, - "No PT_LOAD segment found in ELF file '%s' (%u program headers examined)", - elf_file, elf_header->e_phnum); goto exit; } @@ -650,9 +635,6 @@ search_elf_file_for_section( munmap(file_memory, file_stats.st_size); } if (fd >= 0 && close(fd) != 0) { - PyErr_Format(PyExc_OSError, - "Failed to close ELF file '%s': %s", - elf_file, strerror(errno)); result = 0; } return result; @@ -732,9 +714,6 @@ search_linux_map_for_section(proc_handle_t *handle, const char* secname, const c if (retval) { break; } - if (PyErr_Occurred()){ - PyErr_Clear(); - } } } From c6b5c6476dafc619d8cb593e39f58a6e044c4a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ux=C3=ADo=20Garc=C3=ADa=20Andrade?= Date: Fri, 1 Aug 2025 23:48:48 +0200 Subject: [PATCH 6/6] Update Misc/NEWS.d/next/Core_and_Builtins/2025-08-01-20-31-30.gh-issue-137293.4x3JbV.rst Co-authored-by: Peter Bierma --- .../2025-08-01-20-31-30.gh-issue-137293.4x3JbV.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-08-01-20-31-30.gh-issue-137293.4x3JbV.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-08-01-20-31-30.gh-issue-137293.4x3JbV.rst index 9c75df36c9e70f..83289d4d9bc875 100644 --- a/Misc/NEWS.d/next/Core_and_Builtins/2025-08-01-20-31-30.gh-issue-137293.4x3JbV.rst +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-08-01-20-31-30.gh-issue-137293.4x3JbV.rst @@ -1 +1 @@ -Ignore Exceptions when searching ELF Files in remote debug since the file containing PyRuntime is the only one that matters. +Fix :exc:`SystemError` when searching ELF Files in :func:`sys.remote_exec`. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy