Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit80284b5

Browse files
eddymulgpshead
andauthored
gh-80334: fix multiprocessing.freeze_support for other spawn platforms (GH-134462)
Doc/library/multiprocessing.rst: freeze_support: Change to specify spawn method instead of platformHave multiprocessing.freeze_support() enable on spawn, not just win32.---------Co-authored-by: Gregory P. Smith <greg@krypto.org>
1 parent74a9c60 commit80284b5

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

‎Doc/library/multiprocessing.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ Miscellaneous
10811081
..function::freeze_support()
10821082

10831083
Add support for when a program which uses:mod:`multiprocessing` has been
1084-
frozen to producea Windows executable. (Has been tested with **py2exe**,
1084+
frozen to producean executable. (Has been tested with **py2exe**,
10851085
**PyInstaller** and **cx_Freeze**.)
10861086

10871087
One needs to call this function straight after the ``if __name__ ==
@@ -1099,10 +1099,10 @@ Miscellaneous
10991099
If the ``freeze_support()`` line is omitted then trying to run the frozen
11001100
executable will raise:exc:`RuntimeError`.
11011101

1102-
Calling ``freeze_support()`` has no effect wheninvoked on any operating
1103-
system other than Windows.In addition, if the module is being run
1104-
normally by the Pythoninterpreteron Windows(the program has not been
1105-
frozen), then ``freeze_support()``has no effect.
1102+
Calling ``freeze_support()`` has no effect whenthe start method is not
1103+
*spawn*.In addition, if the module is being run normally by the Python
1104+
interpreter (the program has not been frozen), then ``freeze_support()``
1105+
has no effect.
11061106

11071107
..function::get_all_start_methods()
11081108

‎Lib/multiprocessing/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def freeze_support(self):
145145
'''Check whether this is a fake forked process in a frozen executable.
146146
If so then run code specified by commandline and exit.
147147
'''
148-
ifsys.platform=='win32'andgetattr(sys,'frozen',False):
148+
ifself.get_start_method()=='spawn'andgetattr(sys,'frozen',False):
149149
from .spawnimportfreeze_support
150150
freeze_support()
151151

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:func:`multiprocessing.freeze_support` now checks for work on any "spawn"
2+
start method platform rather than only on Windows.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp