From: Serhiy Storchaka Date: Sat, 9 Dec 2023 13:13:40 +0000 (+0200) Subject: [3.12] gh-79429: Ignore FileNotFoundError when remove a temporary directory in the... X-Git-Tag: v3.12.2~354 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7e82c626c44a6924af38d0a8af3cc8b2d13873ec;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-79429: Ignore FileNotFoundError when remove a temporary directory in the multiprocessing finalizer (GH-112865) --- diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py index 6ee0d33e88a0..8ff82bf86ff9 100644 --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -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 index 000000000000..8363ab54c966 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-12-08-11-52-08.gh-issue-79429.Nf9VK2.rst @@ -0,0 +1,2 @@ +Ignore FileNotFoundError when remove a temporary directory in the +multiprocessing finalizer.