diff options
author | Carl Friedrich Bolz-Tereick <cfbolz@gmx.de> | 2021-04-23 21:27:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-23 21:27:14 (GMT) |
commit | 1e9f0933095403b215c2c4a0be7915d034ff7026 (patch) | |
tree | 3e243c4244ac286f67c62ef23f913da769975acb /Lib/test/pickletester.py | |
parent | f24e2e5464ba6498e7b8d73c3f9b417d59fd1b26 (diff) | |
download | cpython-1e9f0933095403b215c2c4a0be7915d034ff7026.zip cpython-1e9f0933095403b215c2c4a0be7915d034ff7026.tar.gz cpython-1e9f0933095403b215c2c4a0be7915d034ff7026.tar.bz2 |
bpo-43907: add missing memoize call in pure python pickling of bytearray (GH-25501)
Diffstat (limited to 'Lib/test/pickletester.py')
-rw-r--r-- | Lib/test/pickletester.py | 8 |
1 files changed, 8 insertions, 0 deletions
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 @@ class AbstractPickleTests(unittest.TestCase): 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 |