cpython/Lib/test/mp_preload_flush.py
Duane Griffin 425f24e4fa
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.
2025-11-23 15:37:15 -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()