diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-12-09 13:31:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-09 13:31:42 (GMT) |
commit | 2d8012f852da3993287b691e7d2b90d6312f8eda (patch) | |
tree | 81aed975c693dcf147e4262d6022f618fab250bc | |
parent | 23234e92236dbb5def20e91d6c5c923483a7506b (diff) | |
download | cpython-2d8012f852da3993287b691e7d2b90d6312f8eda.zip cpython-2d8012f852da3993287b691e7d2b90d6312f8eda.tar.gz cpython-2d8012f852da3993287b691e7d2b90d6312f8eda.tar.bz2 |
[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 <storchaka@gmail.com>
-rw-r--r-- | Lib/multiprocessing/util.py | 5 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2023-12-08-11-52-08.gh-issue-79429.Nf9VK2.rst | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py index 6ee0d33..8ff82bf 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 0000000..8363ab5 --- /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. |