]> 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:52:50 +0000 (10:52 -0700)
committerGitHub <noreply@github.com>
Mon, 13 Jun 2022 17:52:50 +0000 (10:52 -0700)
commitf9585e2adc36fb2886f96ef86a5aa14215fc1151
treec9cf13b54d8a4f44b03015893c911d6382225024
parent58277de8e651df287ceae053eeb321c0f8406a1b
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/_common.py
Misc/NEWS.d/next/Library/2022-05-31-14-58-40.gh-issue-93353.9Hvm6o.rst [new file with mode: 0644]