bpo-33725: multiprocessing uses spawn by default on macOS (GH-13603)

On macOS, the multiprocessing module now uses the "spawn" start
method by default.
This commit is contained in:
Victor Stinner 2019-05-28 16:02:50 +02:00 committed by GitHub
parent a85a1d337d
commit 17a5588740
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 2 deletions

View file

@ -309,7 +309,12 @@ if sys.platform != 'win32':
'spawn': SpawnContext(),
'forkserver': ForkServerContext(),
}
_default_context = DefaultContext(_concrete_contexts['fork'])
if sys.platform == 'darwin':
# bpo-33725: running arbitrary code after fork() is no longer reliable
# on macOS since macOS 10.14 (Mojave). Use spawn by default instead.
_default_context = DefaultContext(_concrete_contexts['spawn'])
else:
_default_context = DefaultContext(_concrete_contexts['fork'])
else: