bpo-39244: multiprocessing return default start method first on macOS (GH-18625)
This commit is contained in:
parent
5eb45d7d4e
commit
db098bc1f0
|
@ -257,10 +257,11 @@ class DefaultContext(BaseContext):
|
|||
if sys.platform == 'win32':
|
||||
return ['spawn']
|
||||
else:
|
||||
methods = ['spawn', 'fork'] if sys.platform == 'darwin' else ['fork', 'spawn']
|
||||
if reduction.HAVE_SEND_HANDLE:
|
||||
return ['fork', 'spawn', 'forkserver']
|
||||
else:
|
||||
return ['fork', 'spawn']
|
||||
methods.append('forkserver')
|
||||
return methods
|
||||
|
||||
|
||||
#
|
||||
# Context types for fixed start method
|
||||
|
|
|
@ -5039,7 +5039,9 @@ class TestStartMethod(unittest.TestCase):
|
|||
self.assertEqual(methods, ['spawn'])
|
||||
else:
|
||||
self.assertTrue(methods == ['fork', 'spawn'] or
|
||||
methods == ['fork', 'spawn', 'forkserver'])
|
||||
methods == ['spawn', 'fork'] or
|
||||
methods == ['fork', 'spawn', 'forkserver'] or
|
||||
methods == ['spawn', 'fork', 'forkserver'])
|
||||
|
||||
def test_preload_resources(self):
|
||||
if multiprocessing.get_start_method() != 'forkserver':
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Fixed :class:`multiprocessing.context.get_all_start_methods`
|
||||
to properly return the default method first on macOS.
|
Loading…
Reference in New Issue