8000 bpo-32146: multiprocessing freeze_support needed outside win32 by bbayles · Pull Request #5195 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-32146: multiprocessing freeze_support needed outside win32 #5195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bpo-32146: Provisional fix for non-Windows executables (forkserver)
  • Loading branch information
bbayles committed Jan 14, 2018
commit 8baf4e4fc686c8e35d4e702bb78812453fe35077
18 changes: 17 additions & 1 deletion Lib/multiprocessing/spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# Licensed to PSF under a Contributor Agreement.
#

import ast
import os
import sys
import runpy
Expand Down Expand Up @@ -83,7 +84,22 @@ def freeze_support():
from multiprocessing.semaphore_tracker import main;
main(r)
sys.exit()
# TODO: fix the command line for the fork server (unix)
# fix the command line for the fork server (unix)
elif (
(len(sys.argv) >= 3) and
(sys.argv[-2] == '-c') and
('forkserver import main;' in sys.argv[-1])
):
cmd = sys.argv[-1]
main_args = cmd.split('main(')[1].rsplit(')', 1)[0].split(', ', 3)
listener_fd = int(main_args[0])
alive_r = int(main_args[1])
preload = ast.literal_eval(main_args[2])
kwds = ast.literal_eval(main_args[3][2:])

from multiprocessing.forkserver import main
main(listener_fd, alive_r, preload, **kwds)
sys.exit()


def get_command_line(**kwds):
Expand Down
0