diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index 5f8e0f0cd46585c..67f3993c2e9dff8 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -256,6 +256,8 @@ def get_start_method(self, allow_none=False): def get_all_start_methods(self): if sys.platform == 'win32': return ['spawn'] + elif sys.platform == 'darwin': + return ['spawn', 'fork', 'forkserver'] else: if reduction.HAVE_SEND_HANDLE: return ['fork', 'spawn', 'forkserver'] diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 4e48cd45e14ca74..24798a1f398ff55 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -4982,6 +4982,8 @@ def test_get_all(self): methods = multiprocessing.get_all_start_methods() if sys.platform == 'win32': self.assertEqual(methods, ['spawn']) + elif sys.platform == 'darwin': + self.assertEqual(methods, ['spawn', 'fork', 'forkserver']) else: self.assertTrue(methods == ['fork', 'spawn'] or methods == ['fork', 'spawn', 'forkserver']) diff --git a/Misc/NEWS.d/next/macOS/2020-02-16-21-24-18.bpo-39244.QGqhjT.rst b/Misc/NEWS.d/next/macOS/2020-02-16-21-24-18.bpo-39244.QGqhjT.rst new file mode 100644 index 000000000000000..c7a0b485062971c --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2020-02-16-21-24-18.bpo-39244.QGqhjT.rst @@ -0,0 +1,2 @@ +Fixed default :class:`multiprocessing.context` in :func:`get_all_start_methods` +if the context is macOS, return the default 'spawn'