gh-128770: fix ResourceWarning in test_pyrepl (#128906)

This commit is contained in:
Thomas Grainger 2025-01-22 12:48:33 +00:00 committed by GitHub
parent a16ded10ad
commit 24c84d816f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1324,8 +1324,7 @@ class TestMain(ReplTestCase):
if readline.backend != "editline":
self.skipTest("GNU readline is not affected by this issue")
hfile = tempfile.NamedTemporaryFile()
self.addCleanup(unlink, hfile.name)
with tempfile.NamedTemporaryFile() as hfile:
env = os.environ.copy()
env["PYTHON_HISTORY"] = hfile.name