bpo-41052: Optout serialization/deserialization for blake2s/b#22189
bpo-41052: Optout serialization/deserialization for blake2s/b#22189corona10 wants to merge 1 commit into
Conversation
|
Before heap types, serialization/deserialization was failed. |
Sorry, something went wrong.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
By default most extension types are not serializable. blake2b is not serializable. Why is it needed to add explicit __reduce__ method?
Sorry, something went wrong.
master (after #21856)Python 3.10.0a0 (heads/master:f76d894dc5, Sep 10 2020, 23:26:39)
[Clang 11.0.0 (clang-1100.0.33.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pickle
>>> import _blake2
>>> pickle.dumps(_blake2.blake2s(), 0)
b'ccopy_reg\n_reconstructor\np0\n(c_blake2\nblake2s\np1\nc__builtin__\nobject\np2\nNtp3\nRp4\n.'
>>> pickle.dumps(_blake2.blake2s(), 1)
b'ccopy_reg\n_reconstructor\nq\x00(c_blake2\nblake2s\nq\x01c__builtin__\nobject\nq\x02Ntq\x03Rq\x04.'before>>> import _blake2
>>> import pickle
>>> pickle.dumps(_blake2.blake2s(), 0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copyreg.py", line 65, in _reduce_ex
raise TypeError("can't pickle %s objects" % base.__name__)
TypeError: can't pickle blake2s objects
>>> pickle.dumps(_blake2.blake2s(), 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copyreg.py", line 65, in _reduce_ex
raise TypeError("can't pickle %s objects" % base.__name__)
TypeError: can't pickle blake2s objects |
Sorry, something went wrong.
|
I created the issue https://bugs.python.org/issue41052 when I found the issue after porting to heap type. |
Sorry, something went wrong.
|
This is no longer needed, is not? |
Sorry, something went wrong.
Cool. I like the fact that it's no longer needed thanks to the generic https://bugs.python.org/issue41052 fix :-D Thanks again for the generic fix! It's way better than such copy/paste fix on each type. |
Sorry, something went wrong.
https://bugs.python.org/issue41052