]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-135335: flush stdout/stderr in forkserver after preloading modules (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 18 Jun 2025 12:40:21 +0000 (14:40 +0200)
committerGitHub <noreply@github.com>
Wed, 18 Jun 2025 12:40:21 +0000 (12:40 +0000)
commita0a1aa3125a1547830b38d93b862204b581361d2
tree94cb9c1d5ea197ceae76abb4a2992e7f9c55da7e
parent28a70a59e467d1a4ddee0a060e0d837311c510f7
[3.13] gh-135335: flush stdout/stderr in forkserver after preloading modules (GH-135338) (#135671)

gh-135335: flush stdout/stderr in forkserver after preloading modules (GH-135338)

If a preloaded module writes to stdout or stderr, and the stream is buffered,
child processes will inherit the buffered data after forking. Attempt to
prevent this by flushing the streams after preload.
(cherry picked from commit 9877d191f441741fc27ae5e7a6dd7ab6d4bcc6b7)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/multiprocessing/forkserver.py
Lib/test/_test_multiprocessing.py
Lib/test/mp_preload_flush.py [new file with mode: 0644]
Misc/NEWS.d/next/Library/2025-06-10-21-42-04.gh-issue-135335.WnUqb_.rst [new file with mode: 0644]