[Python-checkins] cpython (2.7): #1065986: add missing error handler in pydoc unicode fix.
r.david.murray
python-checkins at python.org
Sun Jan 5 23:14:27 CET 2014
http://hg.python.org/cpython/rev/e57660acc6d4
changeset: 88316:e57660acc6d4
branch: 2.7
user: R David Murray <rdmurray at bitdance.com>
date: Sun Jan 05 17:14:08 2014 -0500
summary:
#1065986: add missing error handler in pydoc unicode fix.
files:
Lib/pydoc.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -209,7 +209,9 @@
def _binstr(obj):
# Ensure that we have an encoded (binary) string representation of obj,
# even if it is a unicode string.
- return obj.encode(_encoding) if isinstance(obj, _unicode) else str(obj)
+ if isinstance(obj, _unicode):
+ return obj.encode(_encoding, 'xmlcharrefreplace')
+ return str(obj)
# ----------------------------------------------------- module manipulation
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list