-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-41052: Optout serialization/deserialization for blake2s/b #22189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -333,12 +333,29 @@ _blake2_blake2s_hexdigest_impl(BLAKE2sObject *self) | |
return _Py_strhex((const char *)digest, self->param.digest_length); | ||
} | ||
|
||
/*[clinic input] | ||
_blake2.blake2s.__reduce__ | ||
|
||
Return the digest value as a string of hexadecimal digits. | ||
[clinic start generated code]*/ | ||
|
||
static PyObject * | ||
_blake2_blake2s___reduce___impl(BLAKE2sObject *self) | ||
/*[clinic end generated code: output=fb085f3da88f0c39 input=49898c2f1ef1ff74]*/ | ||
{ | ||
PyErr_Format(PyExc_TypeError, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vstinner This function is very redundant with this issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe a public marco :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that exposing it to the public is the proper way. |
||
"cannot pickle %s object", | ||
Py_TYPE(self)->tp_name); | ||
return NULL; | ||
} | ||
|
||
|
||
static PyMethodDef py_blake2s_methods[] = { | ||
_BLAKE2_BLAKE2S_COPY_METHODDEF | ||
_BLAKE2_BLAKE2S_DIGEST_METHODDEF | ||
_BLAKE2_BLAKE2S_HEXDIGEST_METHODDEF | ||
_BLAKE2_BLAKE2S_UPDATE_METHODDEF | ||
_BLAKE2_BLAKE2S___REDUCE___METHODDEF | ||
{NULL, NULL} | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than having to copy/paste such code in each type, would it be possible to have a protocol like:
This code raises
TypeError: unhashable type: 'NotHashable'
.cc @pitrou @serhiy-storchaka