Skip to content

Commit 7dcf6e1

Browse files
authored
gh-137996: Fix path to __main__ in forkserver preload logic
Let the __main__ module be preloaded by extracting the necessary path from the spawn.get_preparation_data() result.
1 parent e545bae commit 7dcf6e1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/multiprocessing/forkserver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ def ensure_running(self):
146146
'main(%d, %d, %r, **%r)')
147147

148148
if self._preload_modules:
149-
desired_keys = {'main_path', 'sys_path'}
149+
desired_keys = {'main_path': 'init_main_from_path', 'sys_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}
151+
main_kws = {x: data[y] for x, y in desired_keys.items() if y in data}
152152
else:
153153
main_kws = {}
154154

0 commit comments

Comments
 (0)