[issue18240] hmac unnecessarily restricts input to "bytes"

2013-06-18 Thread Jonas Borgström

Jonas Borgström added the comment:

Of course. I've now signed and filed the agreement.

--

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



[issue18240] hmac unnecessarily restricts input to "bytes"

2013-06-18 Thread Jonas Borgström

Jonas Borgström added the comment:

Patch updated to include tests and versionchanged tags

--
Added file: http://bugs.python.org/file30637/hmac2.patch

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



[issue18240] hmac unnecessarily restricts input to "bytes"

2013-06-17 Thread Jonas Borgström

Changes by Jonas Borgström :


--
keywords: +patch
Added file: http://bugs.python.org/file30628/hmac.patch

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



[issue18240] hmac unnecessarily restricts input to "bytes"

2013-06-17 Thread Jonas Borgström

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 
<http://bugs.python.org/issue18240>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com