mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
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.
This commit is contained in:
commit
525faaeffc
4 changed files with 44 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue