File tree Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ to start a process. These *start methods* are
102
102
will not be inherited. Starting a process using this method is
103
103
rather slow compared to using *fork * or *forkserver *.
104
104
105
- Available on Unix and Windows. The default on Windows.
105
+ Available on Unix and Windows. The default on Windows and macOS .
106
106
107
107
*fork *
108
108
The parent process uses :func: `os.fork ` to fork the Python
@@ -124,6 +124,11 @@ to start a process. These *start methods* are
124
124
Available on Unix platforms which support passing file descriptors
125
125
over Unix pipes.
126
126
127
+ .. versionchanged :: 3.8
128
+
129
+ On macOS, *spawn * start method is now the default: *fork * start method is no
130
+ longer reliable on macOS, see :issue: `33725 `.
131
+
127
132
.. versionchanged :: 3.4
128
133
*spawn * added on all unix platforms, and *forkserver * added for
129
134
some unix platforms.
Original file line number Diff line number Diff line change @@ -469,6 +469,16 @@ access the ``madvise()`` system call.
469
469
(Contributed by Zackery Spytz in :issue: `32941 `.)
470
470
471
471
472
+ multiprocessing
473
+ ---------------
474
+
475
+ Added new :mod: `multiprocessing.shared_memory ` module.
476
+ (Contributed Davin Potts in :issue: `35813 `.)
477
+
478
+ On macOS, the *spawn * start method is now used by default.
479
+ (Contributed by Victor Stinner in :issue: `33725 `.)
480
+
481
+
472
482
os
473
483
--
474
484
Original file line number Diff line number Diff line change @@ -309,7 +309,12 @@ def _check_available(self):
309
309
'spawn' : SpawnContext (),
310
310
'forkserver' : ForkServerContext (),
311
311
}
312
- _default_context = DefaultContext (_concrete_contexts ['fork' ])
312
+ if sys .platform == 'darwin' :
313
+ # bpo-33725: running arbitrary code after fork() is no longer reliable
314
+ # on macOS since macOS 10.14 (Mojave). Use spawn by default instead.
315
+ _default_context = DefaultContext (_concrete_contexts ['spawn' ])
316
+ else :
317
+ _default_context = DefaultContext (_concrete_contexts ['fork' ])
313
318
314
319
else :
315
320
Original file line number Diff line number Diff line change
1
+ On macOS, the :mod: `multiprocessing ` module now uses *spawn * start method by
2
+ default.
You can’t perform that action at this time.
0 commit comments