[issue40960] Fix the example in hashlib documentarion

2020-06-12 Thread Marcelo


Marcelo  added the comment:

ooops, thank you!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40960] Fix the example in hashlib documentarion

2020-06-12 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Hi Marcelo,

Thanks for the report.  The version of the documentation that you linked to is 
for Python 2.  At the top of that page, there is a redirect to the Python 3 
documentation at https://docs.python.org/3/library/hashlib.html.  You'll see 
that the Python 3 documentation does use bytes for that example.

--
nosy: +cheryl.sabella
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40960] Fix the example in hashlib documentarion

2020-06-12 Thread Marcelo


New submission from Marcelo :

The documentation found in https://docs.python.org/2/library/hashlib.html

give us the following example:

```
More condensed:

>>> hashlib.sha224("Nobody inspects the spammish repetition").hexdigest()
'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'
```

Although, we get the error if not encode the string:
```
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Unicode-objects must be encoded before hashing
```

So the example should be (string to bytes):
`hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest()`

--
assignee: docs@python
components: Documentation
messages: 371354
nosy: docs@python, marcelog...@gmail.com
priority: normal
severity: normal
status: open
title: Fix the example in hashlib documentarion
type: behavior
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com