From a2c9a3b0aad0aca332197ac5eed41eb41442fb0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maurycy=20Paw=C5=82owski-Wiero=C5=84ski?= Date: Wed, 19 Aug 2026 22:27:00 +0200 Subject: [PATCH 1/2] gh-156060: Do not scan every process four times in `remote_debugging.get_child_pids()` on macOS (#156061) --- Modules/_remote_debugging/subprocess.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/_remote_debugging/subprocess.c b/Modules/_remote_debugging/subprocess.c index cdad75e318be91..056cc6773a88b4 100644 --- a/Modules/_remote_debugging/subprocess.c +++ b/Modules/_remote_debugging/subprocess.c @@ -307,6 +307,7 @@ get_child_pids_platform(pid_t target_pid, int recursive, pid_array_t *result) PyErr_SetString(PyExc_OSError, "Failed to get process count"); goto done; } + n_pids /= sizeof(pid_t); /* Allocate buffer for PIDs (add some slack for new processes) */ int buffer_size = n_pids + 64; @@ -322,6 +323,7 @@ get_child_pids_platform(pid_t target_pid, int recursive, pid_array_t *result) PyErr_SetString(PyExc_OSError, "Failed to list PIDs"); goto done; } + actual /= sizeof(pid_t); /* Build pid -> ppid mapping */ ppids = (pid_t *)PyMem_Malloc(actual * sizeof(pid_t)); From bf95881b84662d3dcd35143495b9880962164fee Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Wed, 19 Aug 2026 21:28:43 +0100 Subject: [PATCH 2/2] Remote Debugging: silence some unused function warnings (#149898) --- Modules/_remote_debugging/subprocess.c | 2 +- Python/remote_debug.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/_remote_debugging/subprocess.c b/Modules/_remote_debugging/subprocess.c index 056cc6773a88b4..1388a75a95c47b 100644 --- a/Modules/_remote_debugging/subprocess.c +++ b/Modules/_remote_debugging/subprocess.c @@ -96,7 +96,7 @@ pid_array_contains(pid_array_t *arr, pid_t pid) /* Find child PIDs using BFS traversal of the pid->ppid mapping. * all_pids and ppids must have the same count (parallel arrays). * Returns 0 on success, -1 on error. */ -static int +UNUSED static int find_children_bfs(pid_t target_pid, int recursive, pid_t *all_pids, pid_t *ppids, size_t pid_count, pid_array_t *result) diff --git a/Python/remote_debug.h b/Python/remote_debug.h index 7b7380d25bf496..12c5963f97c0e6 100644 --- a/Python/remote_debug.h +++ b/Python/remote_debug.h @@ -183,7 +183,7 @@ _Py_RemoteDebug_ReadRemoteMemory(proc_handle_t *handle, uintptr_t remote_address typedef int (*section_validator_t)(proc_handle_t *handle, uintptr_t address); // Validate that a candidate address starts with _Py_Debug_Cookie. -static int +UNUSED static int _Py_RemoteDebug_ValidatePyRuntimeCookie(proc_handle_t *handle, uintptr_t address) { if (address == 0) {