Skip to content

Commit ec33463

Browse files
committed
gh-126631: fix pre-loading of __main__
The `main_path` parameter was renamed `init_main_from_name`, update the forkserver code accordingly.
1 parent 2677dd0 commit ec33463

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Lib/multiprocessing/forkserver.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,13 @@ def ensure_running(self):
145145
cmd = ('from multiprocessing.forkserver import main; ' +
146146
'main(%d, %d, %r, **%r)')
147147

148+
main_kws = {}
148149
if self._preload_modules:
149-
desired_keys = {'main_path', 'sys_path'}
150150
data = spawn.get_preparation_data('ignore')
151-
main_kws = {x: y for x, y in data.items() if x in desired_keys}
152-
else:
153-
main_kws = {}
151+
if 'sys_path' in data:
152+
main_kws['sys_path'] = data['sys_path']
153+
if 'init_main_from_path' in data:
154+
main_kws['main_path'] = data['init_main_from_path']
154155

155156
with socket.socket(socket.AF_UNIX) as listener:
156157
address = connection.arbitrary_address('AF_UNIX')

0 commit comments

Comments
 (0)