From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sat, 9 Dec 2023 13:31:42 +0000 (+0100) Subject: [3.11] gh-79429: Ignore FileNotFoundError when remove a temporary directory in the... X-Git-Tag: v3.11.8~296 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2d8012f852da3993287b691e7d2b90d6312f8eda;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-79429: Ignore FileNotFoundError when remove a temporary directory in the multiprocessing finalizer (GH-112865) (GH-112897) (cherry picked from commit 7e82c626c44a6924af38d0a8af3cc8b2d13873ec) Co-authored-by: Serhiy Storchaka --- 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.