]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-93353: Fix importlib.resources._tempfile() finalizer (GH-93377)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 13 Jun 2022 17:49:48 +0000 (10:49 -0700)
committerGitHub <noreply@github.com>
Mon, 13 Jun 2022 17:49:48 +0000 (10:49 -0700)
commitdc6dd8ee873ed96027d30c8a2e96518657d46241
tree8f5be32449584b2de02020bbb82cb9cbdf50c146
parent3d1c080591910c9c1ee80e5465ce7c91b67c907d
gh-93353: Fix importlib.resources._tempfile() finalizer (GH-93377)

Fix the importlib.resources.as_file() context manager to remove the
temporary file if destroyed late during Python finalization: keep a
local reference to the os.remove() function. Patch by Victor Stinner.
(cherry picked from commit 443ca731d6b1267fe2f92985e0490460c95e44a8)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/importlib/resources/_common.py
Misc/NEWS.d/next/Library/2022-05-31-14-58-40.gh-issue-93353.9Hvm6o.rst [new file with mode: 0644]