[3.12] gh-122311: Fix some error messages in pickle (GH-122386) (GH-122388)

(cherry picked from commit 3b034d26eb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-07-29 11:27:34 +02:00 committed by GitHub
parent ecc97cb432
commit a3076c734d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 7 deletions

View file

@ -1984,8 +1984,10 @@ class AbstractPicklingErrorTests:
pb = pickle.PickleBuffer(b"foobar")
for proto in range(0, 5):
with self.subTest(proto=proto):
with self.assertRaises(pickle.PickleError):
with self.assertRaises(pickle.PickleError) as cm:
self.dumps(pb, proto)
self.assertEqual(str(cm.exception),
'PickleBuffer can only be pickled with protocol >= 5')
def test_non_continuous_buffer(self):
if self.pickler is pickle._Pickler: