]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] 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:42:18 +0000 (14:42 +0200)
committerGitHub <noreply@github.com>
Wed, 18 Jun 2025 12:42:18 +0000 (12:42 +0000)
commit9ac369cb73eaa1f67a2868780b8f7e3e19a236db
tree41a14770c3857fb6990521223851657e6dc3574c
parent91914fd448a470a48ffc34bb7572e3db2997afad
[3.14] gh-135335: flush stdout/stderr in forkserver after preloading modules (GH-135338) (#135670)

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]