classification
Title: hashlib's docstring throws exception in pydoc
Type: crash Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.6, Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: erickt, gregory.p.smith
Priority: normal Keywords: easy

Created on 2008-08-28 17:43 by erickt, last changed 2008-08-31 16:36 by gregory.p.smith. This issue is now closed.

Messages (2)
msg72099 - (view) Author: Erick Tryzelaar (erickt) Date: 2008-08-28 17:43
Hello,

I noticed that doing "pydoc3.0 hashlib" was throwing this exception:

Traceback (most recent call last):
  File "/opt/local/bin/pydoc3.0", line 5, in <module>
    pydoc.cli()
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/pydoc.py", line 2237, in cli
    help.help(arg)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/pydoc.py", line 1714, in help
    elif request: doc(request, 'Help on %s:')
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/pydoc.py", line 1504, in doc
    pager(render_doc(thing, title, forceload))
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/pydoc.py", line 1319, in pager
    pager(text)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/pydoc.py", line 1339, in <lambda>
    return lambda text: pipepager(text, 'less')
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/pydoc.py", line 1360, in pipepager
    pipe.write(text)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/io.py", line 1486, in write
    b = encoder.encode(s)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/encodings/mac_roman.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]


This problem is coming from this block of text:

    >>> import hashlib
    >>> m = hashlib.md5()
    >>> m.update(b"Nobody inspects")
    >>> m.update(b" the spammish repetition")
    >>> m.digest()
    b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'

Specifically, the last line. It seems that pydoc is interpreting the 
last line as a unicode string, and then when it tries to print it out on 
my mac it errors out.
msg72208 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2008-08-31 16:36
fixed in trunk r66093, py3k r66094, release25-maint r66095
History
Date User Action Args
2008-08-31 16:36:50gregory.p.smithsetstatus: open -> closed
keywords: + easy
resolution: fixed
messages: + msg72208
versions: + Python 2.6, Python 2.5
2008-08-31 15:42:40gregory.p.smithsetpriority: normal
assignee: gregory.p.smith
nosy: + gregory.p.smith
2008-08-28 17:43:19ericktcreate