Issue #13505: Make pickling of bytes object compatible with Python 2.
Initial patch by sbt.
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 49be720..cab0523 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -636,9 +636,15 @@
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