This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Unsupported provider

classification
Title: hashlib.HASH objects should officially expose the hash name
Type: enhancement Stage: resolved
Components: Documentation, Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: christian.heimes, dholth, docs@python, gregory.p.smith, jaraco, python-dev
Priority: normal Keywords: needs review

Created on 2013-07-22 20:29 by jaraco, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (8)
msg193563 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2013-07-22 20:29
In hashlib, the HASH objects currently supply a 'name' attribute, reflecting the name used to initialize the hash object, and they have since Python 2.5. However, this interface is not published so isn't honored by other platforms (namely pypy).

I propose the '.name' attribute be formally added to the documentation to reflect the actual implementation.

I suggest this change be considered as a bugfix release if the original intention was for the '.name' attribute to be public (as it's a bug in the documentation if the intended and implemented interface isn't fully documented).

I plan to do some research to ascertain the intention of this attribute (as can be inferred from tests and the source). For now, I'll assume Python 3.4 only.

Any comments or suggestions welcome.
msg193564 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-22 20:37
Sounds like a good idea.
msg193568 - (view) Author: Daniel Holth (dholth) * Date: 2013-07-22 22:05
fwiw pypy 2 supports HASH.name but the older 1.9 (still part of some Linux distributions) did not.
msg194242 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2013-08-03 09:43
It's not obvious to me if the authors originally intended to have the 'name' attribute as a formal interface, so I've decided the change should probably be added to Python 3.4. Here's a diff I've put together: http://paste.jaraco.com/tMdQ2

It updates the documentation and adds a test to guarantee the interface. I'm unsure about the RST syntax, so I would appreciate a review of the syntax there. Also, I haven't run the test yet, but I'll do that at a later date.
msg194453 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-05 06:54
New changeset 238c37e4c395 by Jason R. Coombs in branch 'default':
Issue 18532: Added tests and documentation to formally specify the .name attribute on hashlib objects.
http://hg.python.org/cpython/rev/238c37e4c395
msg194454 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2013-08-05 06:56
I've confirmed the tests pass and the updated documentation renders nicely and without warnings. These changes now make the name attribute officially-supported and tested.
msg194545 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-08-06 13:52
I added some tests in 5fbf23e947d8 and found a bug in the _sha1 module, too.
msg195261 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-08-15 16:33
The builtin hash algorithms still had upper case names. I fixed it in 
revision http://hg.python.org/cpython/rev/9a4949f5d15c
History
Date User Action Args
2022-04-11 14:57:48adminsetgithub: 62732
2013-08-15 16:33:28christian.heimessetstage: patch review -> resolved
2013-08-15 16:33:22christian.heimessetmessages: + msg195261
2013-08-06 13:52:44christian.heimessetstatus: open -> closed

messages: + msg194545
2013-08-05 06:56:07jaracosetresolution: fixed
messages: + msg194454
2013-08-05 06:54:54python-devsetnosy: + python-dev
messages: + msg194453
2013-08-03 09:43:46jaracosetkeywords: + needs review
stage: needs patch -> patch review
2013-08-03 09:43:08jaracosetmessages: + msg194242
2013-07-22 22:05:40dholthsetnosy: + dholth
messages: + msg193568
2013-07-22 20:37:17christian.heimessetnosy: + gregory.p.smith, christian.heimes
messages: + msg193564

type: enhancement
stage: needs patch
2013-07-22 20:29:00jaracocreate