Submitter | Yuya Nishihara |
---|---|
Date | Feb. 26, 2015, 2:58 p.m. |
Message ID | <1616acd9a1e2b72b00f9.1424962690@mimosa> |
Download | mbox | patch |
Permalink | /patch/7834/ |
State | Accepted |
Headers | show |
Comments
On Thu, 2015-02-26 at 23:58 +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1424961033 -32400 > # Thu Feb 26 23:30:33 2015 +0900 > # Branch stable > # Node ID 1616acd9a1e2b72b00f9a00ec0c3db6397d6d972 > # Parent 756c5c8331b06caba7a9b1bc1d0943323cf65b93 > 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. Uniderp. Queued for stable, thanks.
Patch
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -230,6 +230,9 @@ def _runcatch(req): 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):