Skip to content
Snippets Groups Projects
Commit 97a548aeb749 authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

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
parent 38824c53c2f1
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment