Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d8012f

Browse files
[3.11] gh-79429: Ignore FileNotFoundError when remove a temporary directory in the multiprocessing finalizer (GH-112865) (GH-112897)
(cherry picked from commit 7e82c62) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent 23234e9 commit 2d8012f

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

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)