[3.14] gh-136285: Improve pickle protocol testing in test_interpreters (GH-136286) (#136333)

gh-136285: Improve `pickle` protocol testing in `test_interpreters` (GH-136286)
(cherry picked from commit 06e347b846)

Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2025-07-06 10:13:13 +02:00 committed by GitHub
parent 2b2cf81a6c
commit d86ca7b610
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 28 additions and 30 deletions

View file

@ -412,9 +412,11 @@ def test_equality(self):
def test_pickle(self):
interp = interpreters.create()
data = pickle.dumps(interp)
unpickled = pickle.loads(data)
self.assertEqual(unpickled, interp)
for protocol in range(pickle.HIGHEST_PROTOCOL + 1):
with self.subTest(protocol=protocol):
data = pickle.dumps(interp, protocol)
unpickled = pickle.loads(data)
self.assertEqual(unpickled, interp)
class TestInterpreterIsRunning(TestBase):