]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-79429: Ignore FileNotFoundError when remove a temporary directory in the...
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 9 Dec 2023 13:13:40 +0000 (15:13 +0200)
committerGitHub <noreply@github.com>
Sat, 9 Dec 2023 13:13:40 +0000 (15:13 +0200)
Lib/multiprocessing/util.py
Misc/NEWS.d/next/Library/2023-12-08-11-52-08.gh-issue-79429.Nf9VK2.rst [new file with mode: 0644]

index 6ee0d33e88a060a68c97717aee4ed2b6792b8e3f..8ff82bf86ff9621aa0a585f50b541da7fd7fe1d1 100644 (file)
@@ -130,7 +130,10 @@ abstract_sockets_supported = _platform_supports_abstract_sockets()
 #
 
 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
diff --git a/Misc/NEWS.d/next/Library/2023-12-08-11-52-08.gh-issue-79429.Nf9VK2.rst b/Misc/NEWS.d/next/Library/2023-12-08-11-52-08.gh-issue-79429.Nf9VK2.rst
new file mode 100644 (file)
index 0000000..8363ab5
--- /dev/null
@@ -0,0 +1,2 @@
+Ignore FileNotFoundError when remove a temporary directory in the
+multiprocessing finalizer.