diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2015-09-29 22:13:01 +0300 |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-09-29 22:13:01 +0300 |
| commit | 11c715f12e9c089f79224d78db59b4907c7d7236 (patch) | |
| tree | 8d6a11db7d8f221c43157517f80b421a64cb3304 /Lib/test | |
| parent | a6b1031b76e9344665db951cdef39aa8f2e186a2 (diff) | |
| parent | 525faaeffc557899b83463f3b1b74d2f39cc7e13 (diff) | |
| download | cpython-git-11c715f12e9c089f79224d78db59b4907c7d7236.tar.gz | |
Issue #25262. Added support for BINBYTES8 opcode in Python implementation of
unpickler. Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8
opcodes no longer silently ignored on 32-bit platforms in C implementation.
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/pickletester.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index 9a2b24b684..2ef48e64d7 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -857,6 +857,26 @@ class AbstractUnpickleTests(unittest.TestCase): self.assert_is_copy([(100,), (100,)], self.loads(b'((Kdtp0\nh\x00l.))')) + def test_binbytes8(self): + dumped = b'\x80\x04\x8e\4\0\0\0\0\0\0\0\xe2\x82\xac\x00.' + self.assertEqual(self.loads(dumped), b'\xe2\x82\xac\x00') + + def test_binunicode8(self): + dumped = b'\x80\x04\x8d\4\0\0\0\0\0\0\0\xe2\x82\xac\x00.' + self.assertEqual(self.loads(dumped), '\u20ac\x00') + + @requires_32b + def test_large_32b_binbytes8(self): + dumped = b'\x80\x04\x8e\4\0\0\0\1\0\0\0\xe2\x82\xac\x00.' + with self.assertRaises((pickle.UnpicklingError, OverflowError)): + self.loads(dumped) + + @requires_32b + def test_large_32b_binunicode8(self): + dumped = b'\x80\x04\x8d\4\0\0\0\1\0\0\0\xe2\x82\xac\x00.' + with self.assertRaises((pickle.UnpicklingError, OverflowError)): + self.loads(dumped) + def test_get(self): pickled = b'((lp100000\ng100000\nt.' unpickled = self.loads(pickled) |
