cpython/Lib/test/mp_preload_flush.py
Miss Islington (bot) 47cb43c0f8
[3.13] gh-135335: Simplify preload regression test using __main__ (GH-138686) (#141887)
gh-135335: Simplify preload regression test using __main__ (GH-138686)

Simplify preload regression test using `__main__`

With the fix for gh-126631 `__main__` modules can be preloaded and the regression
test for gh-135335 can be simplified to just use a self-contained script rather
than requiring a module.

Note this assumes and implicitly tests that `__main__` is preloaded by default.
(cherry picked from commit 425f24e4fa)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2025-11-23 19:09:40 -08:00

11 lines
291 B
Python

import multiprocessing
import sys
print(__name__, end='', file=sys.stderr)
print(__name__, end='', file=sys.stdout)
if __name__ == '__main__':
multiprocessing.set_start_method('forkserver')
for _ in range(2):
p = multiprocessing.Process()
p.start()
p.join()