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

SourceForge.net noreply at sourceforge.net
Sun Nov 14 11:22:32 CET 2004


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

Category: Library (Lib)
>Group: Python 2.5
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.


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

>Comment By: Martin v. Löwis (loewis)
Date: 2004-11-14 11:22

Message:
Logged In: YES 
user_id=21627

This is a too major change so short before the 2.4 release,
so postponing it 2.5.

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

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