SIGN IN SIGN UP
python / cpython UNCLAIMED

The Python programming language

0 0 1 Python

[3.14] gh-144503: Pass sys.argv to forkserver as real argv elements (GH-148194) (#148195)

Avoid embedding the parent's sys.argv into the forkserver -c command
string via repr().  When sys.argv is large (e.g. thousands of file
paths from a pre-commit hook), the resulting single argument could
exceed the OS per-argument length limit (MAX_ARG_STRLEN on Linux,
typically 128 KiB), causing posix_spawn to fail and the parent to
observe a BrokenPipeError.

Instead, append the argv entries as separate command-line arguments
after -c; the forkserver child reads them back as sys.argv[1:].  This
cannot exceed any limit the parent itself did not already satisfy.

Regression introduced by gh-143706 / 298d5440eb8.
(cherry picked from commit 5e9d90b615b94469081b39a7b0808fea86c417be)
G
Gregory P. Smith committed
25369a8c78bb2d335d11dc5fb835180974d7cccb
Parent: 8f59d40
Committed by GitHub <noreply@github.com> on 4/7/2026, 6:19:32 AM