[Patches] [ python-Patches-1065986 ] Fix pydoc crashing on unicode strings

SourceForge.net noreply at sourceforge.net
Sun Nov 14 02:36:55 CET 2004


Patches item #1065986, was opened at 2004-11-14 03:36
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1065986&group_id=5470

Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Cherniavsky Beni (cben)
Assigned to: Nobody/Anonymous (nobody)
Summary: Fix pydoc crashing on unicode strings

Initial Comment:
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.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1065986&group_id=5470


More information about the Patches mailing list