From fb13ecb29203763d707471fe29d290441e91244c Mon Sep 17 00:00:00 2001 From: esadomer <54475303+esadomer@users.noreply.github.com> Date: Tue, 13 Oct 2026 19:49:41 +0300 Subject: [PATCH 1/3] Exercise load in the pickle closed-file test --- Lib/test/pickletester.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index c53262e358b48ea..09d4c6ebd0ba67c 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -4910,10 +4910,10 @@ def test_dump_closed_file(self): os_helper.unlink(TESTFN) def test_load_closed_file(self): - f = open(TESTFN, "wb") + f = open(TESTFN, "w+b") try: f.close() - self.assertRaises(ValueError, self.dump, 123, f) + self.assertRaises(ValueError, self.load, f) finally: os_helper.unlink(TESTFN) From c7215cddbdc88adce0e8153d38c10e2fc7805a7c Mon Sep 17 00:00:00 2001 From: esadomer <54475303+esadomer@users.noreply.github.com> Date: Tue, 13 Oct 2026 20:09:39 +0300 Subject: [PATCH 2/3] gh-159361: Add NEWS entry for pickle-closed-load-test --- .../next/Tests/2026-10-13-20-09-39.gh-issue-159361.pKlCls.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2026-10-13-20-09-39.gh-issue-159361.pKlCls.rst diff --git a/Misc/NEWS.d/next/Tests/2026-10-13-20-09-39.gh-issue-159361.pKlCls.rst b/Misc/NEWS.d/next/Tests/2026-10-13-20-09-39.gh-issue-159361.pKlCls.rst new file mode 100644 index 000000000000000..424317d565ab90a --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2026-10-13-20-09-39.gh-issue-159361.pKlCls.rst @@ -0,0 +1,2 @@ +Fix the pickle closed-file loading test to exercise loading rather than +dumping in both the Python and C implementations. From ae6b19e34248a73a8172d2f61e6ea1447028a177 Mon Sep 17 00:00:00 2001 From: esadomer <54475303+esadomer@users.noreply.github.com> Date: Tue, 13 Oct 2026 21:07:15 +0300 Subject: [PATCH 3/3] gh-159361: Omit NEWS for test-only changes --- .../next/Tests/2026-10-13-20-09-39.gh-issue-159361.pKlCls.rst | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 Misc/NEWS.d/next/Tests/2026-10-13-20-09-39.gh-issue-159361.pKlCls.rst diff --git a/Misc/NEWS.d/next/Tests/2026-10-13-20-09-39.gh-issue-159361.pKlCls.rst b/Misc/NEWS.d/next/Tests/2026-10-13-20-09-39.gh-issue-159361.pKlCls.rst deleted file mode 100644 index 424317d565ab90a..000000000000000 --- a/Misc/NEWS.d/next/Tests/2026-10-13-20-09-39.gh-issue-159361.pKlCls.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix the pickle closed-file loading test to exercise loading rather than -dumping in both the Python and C implementations.