msg191321 - (view) |
Author: Jonas Borgström (jborgstrom) * |
Date: 2013-06-17 10:38 |
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. |
|
|
msg191324 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2013-06-17 11:58 |
Good idea! We can also lift the restriction for ``key`` a bit. It can also take a bytearray as argument. bytearray has translate() and supports bytes + bytearay. |
|
|
msg191374 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2013-06-17 20:37 |
Thanks for your patch! Please add tests for the new feature. The documentation needs versionchanged tags, too. |
|
|
msg191395 - (view) |
Author: Jonas Borgström (jborgstrom) * |
Date: 2013-06-18 10:49 |
Patch updated to include tests and versionchanged tags |
|
|
msg191396 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2013-06-18 11:40 |
Thanks for your update. As far as I can tell you haven't signed our contributor agreement yet. Can you please do so? http://www.python.org/psf/contrib/ http://www.python.org/psf/contrib/contrib-form/ |
|
|
msg191398 - (view) |
Author: Jonas Borgström (jborgstrom) * |
Date: 2013-06-18 11:48 |
Of course. I've now signed and filed the agreement. |
|
|
msg191399 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2013-06-18 11:53 |
It may take a day or two until your signature makes it through red tape. I'll get back to you. :) |
|
|
msg191757 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2013-06-24 12:26 |
Your account hasn't been flagged yet. I'm going to ping the person in charge. |
|
|
msg192120 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2013-07-01 11:08 |
New changeset 636947fe131e by Christian Heimes in branch 'default': Issue 18240: The HMAC module is no longer restricted to bytes and accepts http://hg.python.org/cpython/rev/636947fe131e |
|
|
msg192121 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2013-07-01 11:09 |
Your CLA came through and I have applied your patch. Thank you very much for your contribution! |
|
|