summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-28 16:02:50 +0200
committerGitHub <noreply@github.com>2019-05-28 16:02:50 +0200
commit17a5588740b3d126d546ad1a13bdac4e028e6d50 (patch)
tree9e2045dcf3bf7772b03efabcb118e1d7c47beace /Lib
parenta85a1d337d26a65036e427341d15e3979f7e9ced (diff)
downloadcpython-git-17a5588740b3d126d546ad1a13bdac4e028e6d50.tar.gz
bpo-33725: multiprocessing uses spawn by default on macOS (GH-13603)
On macOS, the multiprocessing module now uses the "spawn" start method by default.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/multiprocessing/context.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py
index 5a4865751c..5f8e0f0cd4 100644
--- a/Lib/multiprocessing/context.py
+++ b/Lib/multiprocessing/context.py
@@ -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: