Skip to content

gh-135335: flush stdout/stderr in forkserver after preloading modules #135338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Set start method explicitly to "forkserver" so it works on MacOS (and…
… if the

defaults change elsewhere in the future)
  • Loading branch information
duaneg committed Jun 16, 2025
commit 9944968baede34b265d2dd0bbed39e4471e90c34
2 changes: 1 addition & 1 deletion Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6815,7 +6815,7 @@ def test_std_streams_flushed_after_preload(self):
f.write('''if 1:
import sys
print('stdout', file=sys.stdout)
print('stderr', file=sys.stderr)''')
print('stderr', file=sys.stderr)\n''')

name = os.path.join(os.path.dirname(__file__), 'mp_preload_flush.py')
env = {'PYTHONPATH': self._temp_dir}
Expand Down
1 change: 1 addition & 0 deletions Lib/test/mp_preload_flush.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

if __name__ == '__main__':
assert 'a' not in sys.modules
multiprocessing.set_start_method('forkserver')
multiprocessing.set_forkserver_preload(['a'])
for _ in range(2):
p = multiprocessing.Process()
Expand Down
Loading