From 92d82d1cf79a223f286e975df2ffdb4e9cd60fca Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sat, 24 May 2025 03:07:44 +0000 Subject: [PATCH 1/2] gh-80334: Have multiprocessing.freeze_support() enable on spawn, not just win32. --- Lib/multiprocessing/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index d0a3ad00e53ad8..051d567d457928 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -145,7 +145,7 @@ def freeze_support(self): '''Check whether this is a fake forked process in a frozen executable. If so then run code specified by commandline and exit. ''' - if sys.platform == 'win32' and getattr(sys, 'frozen', False): + if self.get_start_method() == 'spawn' and getattr(sys, 'frozen', False): from .spawn import freeze_support freeze_support() From 7264d23b688b4046129f23b1b426680aedd89ae1 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sat, 24 May 2025 03:10:38 +0000 Subject: [PATCH 2/2] NEWS --- .../next/Library/2025-05-24-03-10-36.gh-issue-80334.z21cMa.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2025-05-24-03-10-36.gh-issue-80334.z21cMa.rst diff --git a/Misc/NEWS.d/next/Library/2025-05-24-03-10-36.gh-issue-80334.z21cMa.rst b/Misc/NEWS.d/next/Library/2025-05-24-03-10-36.gh-issue-80334.z21cMa.rst new file mode 100644 index 00000000000000..228429516db416 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-05-24-03-10-36.gh-issue-80334.z21cMa.rst @@ -0,0 +1,2 @@ +:func:`multiprocessing.freeze_support` now checks for work on any "spawn" +start method platform rather than only on Windows.