Skip to content

[3.13] gh-135335: flush stdout/stderr in forkserver after preloading modules (GH-135338)#135671

Merged
vstinner merged 1 commit intopython:3.13from
miss-islington:backport-9877d19-3.13
Jun 18, 2025
Merged

[3.13] gh-135335: flush stdout/stderr in forkserver after preloading modules (GH-135338)#135671
vstinner merged 1 commit intopython:3.13from
miss-islington:backport-9877d19-3.13

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jun 18, 2025

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 9877d19)

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

…odules (pythonGH-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 9877d19)

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>
@miss-islington miss-islington requested a review from gpshead as a code owner June 18, 2025 12:17
@vstinner vstinner enabled auto-merge (squash) June 18, 2025 12:18
@vstinner vstinner merged commit a0a1aa3 into python:3.13 Jun 18, 2025
38 checks passed
@miss-islington miss-islington deleted the backport-9877d19-3.13 branch January 2, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants