Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hashlib.HASH objects should officially expose the hash name #62732

Closed
jaraco opened this issue Jul 22, 2013 · 8 comments
Closed

hashlib.HASH objects should officially expose the hash name #62732

jaraco opened this issue Jul 22, 2013 · 8 comments
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@jaraco
Copy link
Member

jaraco commented Jul 22, 2013

BPO 18532
Nosy @gpshead, @jaraco, @tiran, @dholth

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2013-08-06.13:52:44.063>
created_at = <Date 2013-07-22.20:29:00.346>
labels = ['type-feature', 'library', 'docs']
title = 'hashlib.HASH objects should officially expose the hash name'
updated_at = <Date 2013-08-15.16:33:28.981>
user = 'https://github.com/jaraco'

bugs.python.org fields:

activity = <Date 2013-08-15.16:33:28.981>
actor = 'christian.heimes'
assignee = 'docs@python'
closed = True
closed_date = <Date 2013-08-06.13:52:44.063>
closer = 'christian.heimes'
components = ['Documentation', 'Library (Lib)']
creation = <Date 2013-07-22.20:29:00.346>
creator = 'jaraco'
dependencies = []
files = []
hgrepos = []
issue_num = 18532
keywords = ['needs review']
message_count = 8.0
messages = ['193563', '193564', '193568', '194242', '194453', '194454', '194545', '195261']
nosy_count = 6.0
nosy_names = ['gregory.p.smith', 'jaraco', 'christian.heimes', 'dholth', 'docs@python', 'python-dev']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue18532'
versions = ['Python 3.4']

@jaraco
Copy link
Member Author

jaraco commented Jul 22, 2013

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.

@jaraco jaraco added docs Documentation in the Doc dir stdlib Python modules in the Lib dir labels Jul 22, 2013
@tiran
Copy link
Member

tiran commented Jul 22, 2013

Sounds like a good idea.

@tiran tiran added the type-feature A feature request or enhancement label Jul 22, 2013
@dholth
Copy link
Mannequin

dholth mannequin commented Jul 22, 2013

fwiw pypy 2 supports HASH.name but the older 1.9 (still part of some Linux distributions) did not.

@jaraco
Copy link
Member Author

jaraco commented Aug 3, 2013

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.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Aug 5, 2013

New changeset 238c37e4c395 by Jason R. Coombs in branch 'default':
bpo-18532: Added tests and documentation to formally specify the .name attribute on hashlib objects.
http://hg.python.org/cpython/rev/238c37e4c395

@jaraco
Copy link
Member Author

jaraco commented Aug 5, 2013

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.

@tiran
Copy link
Member

tiran commented Aug 6, 2013

I added some tests in 5fbf23e947d8 and found a bug in the _sha1 module, too.

@tiran tiran closed this as completed Aug 6, 2013
@tiran
Copy link
Member

tiran commented Aug 15, 2013

The builtin hash algorithms still had upper case names. I fixed it in
revision http://hg.python.org/cpython/rev/9a4949f5d15c

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants