Issue18240
Created on 2013-06-17 10:38 by jborgstrom, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| hmac.patch | jborgstrom, 2013-06-17 20:18 | Proposed patch | review | |
| hmac2.patch | jborgstrom, 2013-06-18 10:49 | Updated patch | review | |
| Messages (10) | |||
|---|---|---|---|
| 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! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:47 | admin | set | github: 62440 |
| 2013-11-12 08:43:07 | mpb | set | nosy:
+ mpb |
| 2013-07-01 11:09:50 | christian.heimes | set | status: open -> closed resolution: fixed messages: + msg192121 stage: patch review -> resolved |
| 2013-07-01 11:08:56 | python-dev | set | nosy:
+ python-dev messages: + msg192120 |
| 2013-06-24 12:26:21 | christian.heimes | set | messages: + msg191757 |
| 2013-06-18 11:53:43 | christian.heimes | set | messages: + msg191399 |
| 2013-06-18 11:48:20 | jborgstrom | set | messages: + msg191398 |
| 2013-06-18 11:40:04 | christian.heimes | set | messages:
+ msg191396 stage: needs patch -> patch review |
| 2013-06-18 10:49:30 | jborgstrom | set | files:
+ hmac2.patch messages: + msg191395 |
| 2013-06-17 20:37:03 | christian.heimes | set | messages: + msg191374 |
| 2013-06-17 20:18:58 | jborgstrom | set | files:
+ hmac.patch keywords: + patch |
| 2013-06-17 11:58:30 | christian.heimes | set | assignee: christian.heimes messages: + msg191324 |
| 2013-06-17 11:48:56 | pitrou | set | nosy:
+ gregory.p.smith, christian.heimes stage: needs patch type: behavior -> enhancement versions: + Python 3.4, - Python 3.3 |
| 2013-06-17 10:38:28 | jborgstrom | create | |

