Skip to content

Commit

Permalink
[3.11] gh-79429: Ignore FileNotFoundError when remove a temporary dir…
Browse files Browse the repository at this point in the history
…ectory in the multiprocessing finalizer (GH-112865) (GH-112897)

(cherry picked from commit 7e82c62)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
  • Loading branch information
miss-islington and serhiy-storchaka committed Dec 9, 2023
1 parent 23234e9 commit 2d8012f
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 2d8012f

Please sign in to comment.