[New-bugs-announce] [issue3715] hashlib's docstring throws exception in pydoc

Erick Tryzelaar report at bugs.python.org
Thu Aug 28 19:44:19 CEST 2008


New submission from Erick Tryzelaar <idadesub at users.sourceforge.net>:

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.

----------
components: Library (Lib)
messages: 72099
nosy: erickt
severity: normal
status: open
title: hashlib's docstring throws exception in pydoc
type: crash
versions: Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3715>
_______________________________________


More information about the New-bugs-announce mailing list