bpo-43907: add missing memoize call in pure python pickling of bytearray (GH-25501)
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index fd05e7a..8e01d31 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -1853,6 +1853,14 @@ def test_bytearray(self):
self.assertNotIn(b'bytearray', p)
self.assertTrue(opcode_in_pickle(pickle.BYTEARRAY8, p))
+ def test_bytearray_memoization_bug(self):
+ for proto in protocols:
+ for s in b'', b'xyz', b'xyz'*100:
+ b = bytearray(s)
+ p = self.dumps((b, b), proto)
+ b1, b2 = self.loads(p)
+ self.assertIs(b1, b2)
+
def test_ints(self):
for proto in protocols:
n = sys.maxsize