classification
Title: Fix pydoc crashing on unicode strings
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cben, loewis, ping, rhettinger (4)
Priority: normal Keywords patch

Created on 2004-11-14 01:36 by cben, last changed 2005-08-24 07:10 by rhettinger.

Files
File name Uploaded Description Edit Remove
PYDOC-UNICODE.diff cben, 2004-11-14 01:36 Path to Lib/pydoc.py to use unicode when needed
Messages (4)
msg47289 - (view) Author: Cherniavsky Beni (cben) Date: 2004-11-14 01:36
The pydoc module currently only outputs ASCII and
crashes with UnicodeEncodeError when printing a unicode
string (in contexts where it prints the str rather than
a repr, e.g. docstrings or variables like
`__credits__`).  The most ironic example of it is that
since patch 1009389 was committed, ``pydoc.py pydoc``
crashes on its own `__credits__`!

This patch changes pydoc help functions to return
unicode strings only when needed; it returns ASCII
strings if all characters are from ASCII.  Therefore
there should be no compatibility problems.

For output, all pager functions were changed to encode
to the locale's preferred encoding and HTML output was
changed to always use UTF-8.

cgitb.py, DocXMLRPCServer.py and/or
SimpleXMLRPCServer.py seems to rely on pydoc to some
degree.  I didn't touch them, so they might still be
broken in this respect.
msg47290 - (view) Author: Martin v. Löwis (loewis) Date: 2004-11-14 10:22
Logged In: YES 
user_id=21627

This is a too major change so short before the 2.4 release,
so postponing it 2.5.
msg47291 - (view) Author: Ka-Ping Yee (ping) Date: 2004-11-17 11:45
Logged In: YES 
user_id=45338

I'm so sorry this has caused so much trouble.
The silly moose comment is my fault; it can be removed.
msg47292 - (view) Author: Raymond Hettinger (rhettinger) Date: 2005-08-24 07:10
Logged In: YES 
user_id=80475

I believe this was fixed.  Feel free to re-open is something
is unresolved.
History
Date User Action Args
2004-11-14 01:36:55cbencreate