You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Raise TypeError in pure Python hmac.digest for non-bytes keys #155426
hmac.digest() reaches key.ljust() with a key type its own class rejects by name, so hmac.digest(memoryview(key), msg, "md5") raises AttributeError instead of TypeError as hmac.HMAC does. I'm aligning the exceptions here but I may consider accepting other types later.
changed the title [-]Pure-Python fallback of `hmac.digest` only accept `bytes` objects as keys[/-][+]Raise `TypeError` in pure Python `hmac.digest` for non-bytes keys[/+]on Aug 9, 2026
Activity
Lib/hmac.pyandLib/hashlib.py#155413pythongh-155426: correctly accept bytes-like keys in `hmac.digest`
pythongh-155426: correctly accept bytes-like keys in `hmac.digest`
pythongh-155426: correctly accept bytes-like keys in `hmac.digest`
[-]Pure-Python fallback of `hmac.digest` only accept `bytes` objects as keys[/-][+]Raise `TypeError` in pure Python `hmac.digest` for non-bytes keys[/+]gh-155426: correctly reject non-bytes keys in `hmac.digest` (#155427)
[3.15] gh-155426: correctly reject non-bytes keys in `hmac.digest` (G…
[3.14] gh-155426: correctly reject non-bytes keys in `hmac.digest` (G…