[3.11] gh-79429: Ignore FileNotFoundError when remove a temporary directory in the multiprocessing finalizer (GH-112865) (GH-112897)

(cherry picked from commit 7e82c626c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2023-12-09 14:31:42 +01:00 committed by GitHub
parent 23234e9223
commit 2d8012f852
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View 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