Skip to content

bpo-37421: Fix multiprocessing get_temp_dir() finalizer #14572

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

Merged
merged 2 commits into from
Jul 4, 2019
Merged
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
Fix if current_process() returs None
  • Loading branch information
vstinner committed Jul 3, 2019
commit 08ad64cf73c60cc6563740c67e11164e4bc90ec4
6 changes: 5 additions & 1 deletion Lib/multiprocessing/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ def log_to_stderr(level=None):

def _remove_temp_dir(rmtree, tempdir):
rmtree(tempdir)
process.current_process()._config['tempdir'] = None

current_process = process.current_process()
# current_process() can be None if the finalizer is called
# late during Python finalization
if current_process is not None:
current_process._config['tempdir'] = None

def get_temp_dir():
# get name of a temp directory which will be automatically cleaned up
Expand Down