Skip to content

Regression in multiprocessing.set_start_method introduced in Python 3.13.4 #135726

Open
@marcelotduarte

Description

@marcelotduarte

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

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesstdlibPython modules in the Lib dirtopic-multiprocessingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy