summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-01-05 22:14:08 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-01-05 22:14:08 (GMT)
commit875565bbd602825fd24eab2978ea4a7f81cfd7cc (patch)
tree0315fff68ee7bd1bb01cf5014b67dfa0689e8e43 /Lib/pydoc.py
parent984f630f0a1cec8cc51371f754d81fb32b9a230f (diff)
downloadcpython-875565bbd602825fd24eab2978ea4a7f81cfd7cc.zip
cpython-875565bbd602825fd24eab2978ea4a7f81cfd7cc.tar.gz
cpython-875565bbd602825fd24eab2978ea4a7f81cfd7cc.tar.bz2
#1065986: add missing error handler in pydoc unicode fix.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index e8b6c08..160ad4a 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -209,7 +209,9 @@ else:
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