]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-140814: Fix freeze_support() setting start method as side effect (GH-144608)
authorGregory P. Smith <68491+gpshead@users.noreply.github.com>
Mon, 16 Mar 2026 05:50:19 +0000 (22:50 -0700)
committerGitHub <noreply@github.com>
Mon, 16 Mar 2026 05:50:19 +0000 (22:50 -0700)
commitee5318025b0f9f4d30d9358627df68181e0d223f
treee661e15d1ca694eed7ee3d811a9f0dfec9aaf075
parent40095d526bd8ddbabee0603c2b502ed6807e5f4d
gh-140814: Fix freeze_support() setting start method as side effect (GH-144608)

freeze_support() called get_start_method() without allow_none=True,
which locked in the default start method context. This caused a
subsequent set_start_method() call to raise "context has already been
set". Use allow_none=True and accept None as a matching value, since
spawn.freeze_support() independently detects spawned child processes.

Test that freeze_support() does not lock in the default start method,
which would prevent a subsequent set_start_method() call.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Lib/multiprocessing/context.py
Lib/test/_test_multiprocessing.py
Misc/NEWS.d/next/Library/2026-02-08-22-04-06.gh-issue-140814.frzSpn.rst [new file with mode: 0644]