]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-135335: flush stdout/stderr in forkserver after preloading modules (#135338)
authorDuane Griffin <duaneg@dghda.com>
Wed, 18 Jun 2025 12:17:02 +0000 (00:17 +1200)
committerGitHub <noreply@github.com>
Wed, 18 Jun 2025 12:17:02 +0000 (14:17 +0200)
commit9877d191f441741fc27ae5e7a6dd7ab6d4bcc6b7
tree4c01f9bbf170004d7aa851346545b4d89bf22b5a
parent5f6ab924653a44e08be23710d5023566e9e9214e
gh-135335: flush stdout/stderr in forkserver after preloading modules (#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.

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]