Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
importioimportpickleclassZeroCopyByteArray(bytearray):def__reduce_ex__(self,protocol):returntype(self), (pickle.PickleBuffer(self),),Nonedata= [ZeroCopyByteArray(),ZeroCopyByteArray(),]# this worksf=io.BytesIO()pickler=pickle.Pickler(f,protocol=5)pickler.dump(data)# this hits memo assertionf=io.BytesIO()pickler=pickle._Pickler(f,protocol=5)pickler.dump(data)
Traceback (most recent call last): File"bug.py", line24, in<module> pickler.dump(data) File"/pickle.py", line487, indumpself.save(obj) File"/pickle.py", line560, insave f(self, obj)# Call unbound method with explicit self^^^^^^^^^^^^ File"/pickle.py", line932, insave_listself._batch_appends(obj) File"/pickle.py", line956, in_batch_appends save(x) File"/pickle.py", line603, insaveself.save_reduce(obj=obj,*rv) File"/pickle.py", line692, insave_reduce save(args) File"/pickle.py", line560, insave f(self, obj)# Call unbound method with explicit self^^^^^^^^^^^^ File"/pickle.py", line887, insave_tuple save(element) File"/pickle.py", line560, insave f(self, obj)# Call unbound method with explicit self^^^^^^^^^^^^ File"/pickle.py", line842, insave_picklebufferself.save_bytearray(m.tobytes()) File"/pickle.py", line821, insave_bytearrayself.memoize(obj) File"/pickle.py", line508, inmemoizeassertid(obj)notinself.memo^^^^^^^^^^^^^^^^^^^^^^^^AssertionError
CPython versions tested on:
3.11
Operating systems tested on:
Linux
Linked PRs
- gh-120380: fix Python implementation of
pickle.Picklerforbytesandbytearrayobjects in protocol version 5. #120422 - [3.13] gh-120380: fix Python implementation of
pickle.Picklerforbytesandbytearrayobjects in protocol version 5. (GH-120422) #120832 - [3.12] gh-120380: fix Python implementation of
pickle.Picklerforbytesandbytearrayobjects in protocol version 5. (GH-120422) #120833
Metadata
Metadata
Assignees
Labels
Projects
Status
Done