Issue #13505: Make pickling of bytes object compatible with Python 2.

Initial patch by sbt.
This commit is contained in:
Alexandre Vassalotti 2011-12-13 13:08:09 -05:00
parent 7b7e39a61f
commit 3bfc65a25b
5 changed files with 94 additions and 57 deletions

View file

@ -636,9 +636,15 @@ class AbstractPickleTests(unittest.TestCase):
def test_bytes(self):
for proto in protocols:
for u in b'', b'xyz', b'xyz'*100:
p = self.dumps(u)
self.assertEqual(self.loads(p), u)
for s in b'', b'xyz', b'xyz'*100:
p = self.dumps(s)
self.assertEqual(self.loads(p), s)
for s in [bytes([i]) for i in range(256)]:
p = self.dumps(s)
self.assertEqual(self.loads(p), s)
for s in [bytes([i, i]) for i in range(256)]:
p = self.dumps(s)
self.assertEqual(self.loads(p), s)
def test_ints(self):
import sys