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

Function get_temp_dir

Lib/multiprocessing/util.py:211–224  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

209 return base_system_tempdir
210
211def get_temp_dir():
212 # get name of a temp directory which will be automatically cleaned up
213 tempdir = process.current_process()._config.get('tempdir')
214 if tempdir is None:
215 import shutil, tempfile
216 base_tempdir = _get_base_temp_dir(tempfile)
217 tempdir = tempfile.mkdtemp(prefix='pymp-', dir=base_tempdir)
218 info('created temp directory %s', tempdir)
219 # keep a strong reference to shutil.rmtree(), since the finalizer
220 # can be called late during Python shutdown
221 Finalize(None, _remove_temp_dir, args=(shutil.rmtree, tempdir),
222 exitpriority=-100)
223 process.current_process()._config['tempdir'] = tempdir
224 return tempdir
225
226#
227# Support for reinitialization of objects when bootstrapping a child process

Callers

nothing calls this directly

Calls 5

_get_base_temp_dirFunction · 0.85
FinalizeClass · 0.85
mkdtempMethod · 0.80
infoFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…