Skip to content

Commit 7e82c62

Browse files
[3.12] gh-79429: Ignore FileNotFoundError when remove a temporary directory in the multiprocessing finalizer (GH-112865)
1 parent 259a4af commit 7e82c62

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Lib/multiprocessing/util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ def is_abstract_socket_namespace(address):
130130
#
131131

132132
def _remove_temp_dir(rmtree, tempdir):
133-
rmtree(tempdir)
133+
def onerror(func, path, err_info):
134+
if not issubclass(err_info[0], FileNotFoundError):
135+
raise
136+
rmtree(tempdir, onerror=onerror)
134137

135138
current_process = process.current_process()
136139
# current_process() can be None if the finalizer is called
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Ignore FileNotFoundError when remove a temporary directory in the
2+
multiprocessing finalizer.

0 commit comments

Comments
 (0)