[3.15] gh-156060: Do not scan every process four times in `remote_debugging.get_child_pids()` on macOS (GH-156061) (#156069)
pablogsal <[email protected]>
| Newsgroups | gmane.comp.python.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://github.com/python/cpython/commit/47724d8edfd1e9aaa1872a563729665f50d02ac3 commit: 47724d8edfd1e9aaa1872a563729665f50d02ac3 branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: pablogsal <[email protected]> date: 2026-08-19T22:49:32+01:00 summary: [3.15] gh-156060: Do not scan every process four times in `remote_debugging.get_child_pids()` on macOS (GH-156061) (#156069) 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]