Open
Description
Bug report
Bug description:
PR #134462 (GH-80334) breaks set_start_method for use in Python (not frozen) and also breaks it for cx_Freeze.
A simple sample using 'spaw', but also breaks with 'fork' or 'forkserver':
import multiprocessing
def foo(q):
q.put("Hello from cx_Freeze")
if __name__ == "__main__":
multiprocessing.freeze_support()
multiprocessing.set_start_method('spawn')
q = multiprocessing.SimpleQueue()
p = multiprocessing.Process(target=foo, args=(q,))
p.start()
print(q.get())
p.join()
This sample worked before in windows and linux for python 3.9 until python 3.13.3.
For cx_Freeze I made a temporary fix.
I suspect that a correct fix is change the line 148 from:
if self.get_start_method() == 'spawn' and getattr(sys, 'frozen', False):
to a simple:
if getattr(sys, 'frozen', False):
CPython versions tested on:
3.13
Operating systems tested on:
Linux