comparison mercurial/scmutil.py @ 43947:b4c82b704180 stable 5.2.2

py3: force bytestr conversion of "reason" in scmutil.callcatch() For instance, reason may be an InvalidURL as shown in added test.
author Denis Laxalde <denis@laxalde.org>
date Wed, 18 Dec 2019 20:17:21 +0100
parents 899e55e2d375
children 60de488cad11
comparison
equal deleted inserted replaced
43868:b06cf2809ec3 43947:b4c82b704180
260 # it might be anything, for example a string 260 # it might be anything, for example a string
261 reason = inst.reason 261 reason = inst.reason
262 if isinstance(reason, pycompat.unicode): 262 if isinstance(reason, pycompat.unicode):
263 # SSLError of Python 2.7.9 contains a unicode 263 # SSLError of Python 2.7.9 contains a unicode
264 reason = encoding.unitolocal(reason) 264 reason = encoding.unitolocal(reason)
265 ui.error(_(b"abort: error: %s\n") % reason) 265 ui.error(_(b"abort: error: %s\n") % stringutil.forcebytestr(reason))
266 elif ( 266 elif (
267 util.safehasattr(inst, b"args") 267 util.safehasattr(inst, b"args")
268 and inst.args 268 and inst.args
269 and inst.args[0] == errno.EPIPE 269 and inst.args[0] == errno.EPIPE
270 ): 270 ):