hmac digestmod is no longer Optional as of 3.8.#3367
Conversation
|
Is this PR correct? I just did a quick edit via the github UI but I don't have an environment setup to test this in front of me. This is related to python/cpython#16805 :) The "odd" thing for this is that 3.8.0 shipped with digestmod=None as the default value. and the code accepts and rejects None properly. So |
srittau
left a comment
There was a problem hiding this comment.
I left my comment below.
| if sys.version_info >= (3, 4): | ||
| if sys.version_info >= (3, 8): | ||
| def new(key: _B, msg: Optional[_B] = ..., | ||
| digestmod: Union[str, Callable[[], _Hash], ModuleType] = ...) -> HMAC: ... |
There was a problem hiding this comment.
It's a bit of a weird situation, but since you must provide the digestmod argument in 3.8 or you get an exception I don't think it would be correct to say that it has a default value. I'd prefer to see two overloads: One where all three arguments must be given and one similar to def new(key, *, digestmod). This would still allow to leave out msg when digestmod is given as a keyword argument, but requires digestmod in all cases.
|
Also, this seems to be missing from the release notes. |
|
@srittau I implemented your suggestion, could you take a look? |
No description provided.