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
Show file tree
Hide file tree
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: Fix and add test for extra preload modules
  • Loading branch information
bbayles committed Jan 16, 2018
commit 97e6a9d748902353cfb4e730c471ff05810ca160
10 changes: 3 additions & 7 deletions Lib/multiprocessing/spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,9 @@ def get_forkserver_args(argv):
# listener_fd and alive_r are integers
# preload is a list
# kwds map strings to lists
main_args = argv[-1].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])

args = [listener_fd, alive_r, preload]
kwds = ast.literal_eval(main_args[3][2:])
parsed = ast.parse(argv[-1])
args = [ast.literal_eval(parsed.body[1].value.args[i]) for i in range(3)]
kwds = ast.literal_eval(parsed.body[1].value.keywords[0].value)
return args, kwds


Expand Down
4 changes: 2 additions & 2 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4554,12 +4554,12 @@ def test_get_forkserver_args(self):
'--multiprocessing-forkserver',
(
"from multiprocessing.forkserver import main; "
"main(8, 9, ['__main__'], "
"main(8, 9, ['__main__', 'other'], "
"**{'sys_path': ['/embed/lib', '/embed/lib/library.zip']})"
)
]
arg 4D4C s, kwds = self.module.get_forkserver_args(argv)
self.assertEqual(args, [8, 9, ['__main__']])
self.assertEqual(args, [8, 9, ['__main__', 'other']])
self.assertEqual(
kwds, {'sys_path': ['/embed/lib', '/embed/lib/library.zip']}
)
Expand Down
0