https://github.com/python/cpython/commit/a2c9a3b0aad0aca332197ac5eed41eb41442fb0c
commit: a2c9a3b0aad0aca332197ac5eed41eb41442fb0c
branch: main
author: Maurycy Pawłowski-Wieroński <[email protected]>
committer: pablogsal <[email protected]>
date: 2026-08-19T20:27:00Z
summary:
gh-156060: Do not scan every process four times in
`remote_debugging.get_child_pids()` on macOS (#156061)
files:
M Modules/_remote_debugging/subprocess.c
diff --git a/Modules/_remote_debugging/subprocess.c
b/Modules/_remote_debugging/subprocess.c
index cdad75e318be914..056cc6773a88b44 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));
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]