Commit 875565bb authored by R David Murray's avatar R David Murray

#1065986: add missing error handler in pydoc unicode fix.

parent 984f630f
...@@ -209,7 +209,9 @@ else: ...@@ -209,7 +209,9 @@ else:
def _binstr(obj): def _binstr(obj):
# Ensure that we have an encoded (binary) string representation of obj, # Ensure that we have an encoded (binary) string representation of obj,
# even if it is a unicode string. # 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 # ----------------------------------------------------- module manipulation
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment