New submission from Jonas Borgström:

Problem:
In hmac.py there's a type check that verifies that the msg parameter is of type 
bytes().

if not isinstance(msg, bytes):
    raise TypeError("expected bytes, but got %r" % type(msg).__name__)

That is incorrect. The hmac module should also work with other data types as 
long as they are supported by the underlying hashlib module, for example 
bytearray() and memoryview().

Suggestion:
Remove that type check. hashlib will make sure str() and other invalid data 
types raises a TypeError.

----------
components: Library (Lib)
messages: 191321
nosy: jborg
priority: normal
severity: normal
status: open
title: hmac unnecessarily restricts input to "bytes"
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18240>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to