https://github.com/python/cpython/commit/d2d245942eccf108ac3c97b82a7dda59a509372c
commit: d2d245942eccf108ac3c97b82a7dda59a509372c
branch: main
author: Joshua Root <[email protected]>
committer: pablogsal <[email protected]>
date: 2026-02-10T08:29:55Z
summary:
gh-144648: Improve libproc usage in _remote_debugging (#144649)
files:
A Misc/NEWS.d/next/macOS/2026-02-10-08-00-17.gh-issue-144648.KEuUXp.rst
M Modules/_remote_debugging/subprocess.c
diff --git
a/Misc/NEWS.d/next/macOS/2026-02-10-08-00-17.gh-issue-144648.KEuUXp.rst
b/Misc/NEWS.d/next/macOS/2026-02-10-08-00-17.gh-issue-144648.KEuUXp.rst
new file mode 100644
index 00000000000000..5f8ba046f3571e
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2026-02-10-08-00-17.gh-issue-144648.KEuUXp.rst
@@ -0,0 +1 @@
+Allowed _remote_debugging to build on more OS versions by using
proc_listpids() rather than proc_listallpids().
diff --git a/Modules/_remote_debugging/subprocess.c
b/Modules/_remote_debugging/subprocess.c
index 2056217664a9ee..1b16dd8343f2a5 100644
--- a/Modules/_remote_debugging/subprocess.c
+++ b/Modules/_remote_debugging/subprocess.c
@@ -273,6 +273,7 @@ get_child_pids_platform(pid_t target_pid, int recursive,
pid_array_t *result)
#if defined(__APPLE__) && TARGET_OS_OSX
+#include <libproc.h>
#include <sys/proc_info.h>
static int
@@ -283,7 +284,7 @@ get_child_pids_platform(pid_t target_pid, int recursive,
pid_array_t *result)
pid_t *ppids = NULL;
/* Get count of all PIDs */
- int n_pids = proc_listallpids(NULL, 0);
+ int n_pids = proc_listpids(PROC_ALL_PIDS, 0, NULL, 0);
if (n_pids <= 0) {
PyErr_SetString(PyExc_OSError, "Failed to get process count");
goto done;
@@ -298,7 +299,7 @@ get_child_pids_platform(pid_t target_pid, int recursive,
pid_array_t *result)
}
/* Get actual PIDs */
- int actual = proc_listallpids(pid_list, buffer_size * sizeof(pid_t));
+ int actual = proc_listpids(PROC_ALL_PIDS, 0, pid_list, buffer_size *
sizeof(pid_t));
if (actual <= 0) {
PyErr_SetString(PyExc_OSError, "Failed to list PIDs");
goto done;
_______________________________________________
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]