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

SourceForge.net noreply at sourceforge.net
Wed Aug 24 09:10:16 CEST 2005


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

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
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: Raymond Hettinger (rhettinger)
Date: 2005-08-24 02:10

Message:
Logged In: YES 
user_id=80475

I believe this was fixed.  Feel free to re-open is something
is unresolved.

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

Comment By: Ka-Ping Yee (ping)
Date: 2004-11-17 06:45

Message:
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.

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

Comment By: Martin v. Löwis (loewis)
Date: 2004-11-14 05: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