New submission from Carl Friedrich Bolz-Tereick <cfb...@gmx.de>:

The new codepath for the BYTEARRAY8 bytecode is missing memoization:

>>> import pickletools, pickle
>>> b = (bytearray(b"abc"), ) * 2
>>> b1, b2 = pickle.loads(pickle.dumps(b, 5)) # C version
>>> b1 is b2
True
(bytearray(b'abc'), bytearray(b'abc'))
>>> b1, b2 = pickle.loads(pickle._dumps(b, 5)) # python version
>>> b1 is b2 # :-(
False

Found it because PyPy is using pickle.py with no C implementation. I'm 
preparing a patch.

----------
messages: 391537
nosy: Carl.Friedrich.Bolz
priority: normal
severity: normal
status: open
title: pickle.py bytearray memoization bug with protocol 5

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43907>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to