Skip to content

Commit

Permalink
[3.12] pythongh-79429: Ignore FileNotFoundError when remove a tempora…
Browse files Browse the repository at this point in the history
…ry directory in the multiprocessing finalizer (pythonGH-112865)
  • Loading branch information
serhiy-storchaka committed Dec 9, 2023
1 parent 259a4af commit 7e82c62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Lib/multiprocessing/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ def is_abstract_socket_namespace(address):
#

def _remove_temp_dir(rmtree, tempdir):
rmtree(tempdir)
def onerror(func, path, err_info):
if not issubclass(err_info[0], FileNotFoundError):
raise
rmtree(tempdir, onerror=onerror)

current_process = process.current_process()
# current_process() can be None if the finalizer is called
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Ignore FileNotFoundError when remove a temporary directory in the
multiprocessing finalizer.

0 comments on commit 7e82c62

Please sign in to comment.