MCPcopy Index your code
hub / github.com/python/cpython / get_preparation_data

Function get_preparation_data

Lib/multiprocessing/spawn.py:160–204  ·  view source on GitHub ↗

Return info about parent needed by child to unpickle process object

(name)

Source from the content-addressed store, hash-verified

158
159
160def get_preparation_data(name):
161 '''
162 Return info about parent needed by child to unpickle process object
163 '''
164 _check_not_importing_main()
165 d = dict(
166 log_to_stderr=util._log_to_stderr,
167 authkey=process.current_process().authkey,
168 )
169
170 if util._logger is not None:
171 d['log_level'] = util._logger.getEffectiveLevel()
172
173 sys_path=sys.path.copy()
174 try:
175 i = sys_path.index('')
176 except ValueError:
177 pass
178 else:
179 sys_path[i] = process.ORIGINAL_DIR
180
181 d.update(
182 name=name,
183 sys_path=sys_path,
184 sys_argv=sys.argv,
185 orig_dir=process.ORIGINAL_DIR,
186 dir=os.getcwd(),
187 start_method=get_start_method(allow_none=True),
188 )
189
190 # Figure out whether to initialise main in the subprocess as a module
191 # or through direct execution (or to leave it alone entirely)
192 main_module = sys.modules['__main__']
193 main_mod_name = getattr(main_module.__spec__, "name", None)
194 if main_mod_name is not None:
195 d['init_main_from_name'] = main_mod_name
196 elif sys.platform != 'win32' or (not WINEXE and not WINSERVICE):
197 main_path = getattr(main_module, '__file__', None)
198 if main_path is not None:
199 if (not os.path.isabs(main_path) and
200 process.ORIGINAL_DIR is not None):
201 main_path = os.path.join(process.ORIGINAL_DIR, main_path)
202 d['init_main_from_path'] = os.path.normpath(main_path)
203
204 return d
205
206#
207# Prepare current process

Callers

nothing calls this directly

Calls 7

getEffectiveLevelMethod · 0.45
copyMethod · 0.45
indexMethod · 0.45
updateMethod · 0.45
isabsMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…