Skip to content

Commit 3d383d7

Browse files
committed
multiprocessing.freeze_support no longer sets the start method globally.
1 parent b14986c commit 3d383d7

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

Lib/multiprocessing/context.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,17 @@ def get_all_start_methods(self):
266266
)
267267
return start_method_names
268268

269+
def freeze_support(self):
270+
'''Check whether this is a fake forked process in a frozen executable.
271+
If so then run code specified by commandline and exit.
272+
'''
273+
start_method = self.get_start_method(allow_none=True)
274+
if start_method is None:
275+
start_method = self._default_context.get_start_method()
276+
if start_method == 'spawn' and getattr(sys, 'frozen', False):
277+
from .spawn import freeze_support
278+
freeze_support()
279+
269280

270281
#
271282
# Context types for fixed start method
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:func:`multiprocessing.freeze_support` no longer sets the start method
2+
globally.

0 commit comments

Comments
 (0)