# HG changeset patch # User Yuya Nishihara # Date 1424961033 -32400 # Node ID 97a548aeb74987a02d74164a791bf7fe749a1a81 # Parent 38824c53c2f1cabe9d57f252c4bb895862b2cd0b dispatch: work around UnicodeDecodeError caused by SSLError of Python 2.7.9 SSLError of Python 2.7.9 may keep error message in unicode. It will be wrapped by URLError(reason) at KeepAliveHandler.do_open, so inst.reason can be a unicode. https://hg.python.org/cpython/file/v2.7.9/Modules/_ssl.c#l329 diff -r 38824c53c2f1 -r 97a548aeb749 mercurial/dispatch.py --- a/mercurial/dispatch.py Thu Feb 05 14:45:49 2015 +0900 +++ b/mercurial/dispatch.py Thu Feb 26 23:30:33 2015 +0900 @@ -230,6 +230,9 @@ except (AttributeError, IndexError): # it might be anything, for example a string reason = inst.reason + if isinstance(reason, unicode): + # SSLError of Python 2.7.9 contains a unicode + reason = reason.encode(encoding.encoding, 'replace') ui.warn(_("abort: error: %s\n") % reason) elif (util.safehasattr(inst, "args") and inst.args and inst.args[0] == errno.EPIPE):