diff mercurial/wireproto.py @ 36291:af0a19d8812b

py3: get bytes-repr of network errors portably This resolves a lot of weird issues in Python 3 around error strings. Differential Revision: https://phab.mercurial-scm.org/D2295
author Augie Fackler <augie@google.com>
date Sat, 17 Feb 2018 01:11:48 -0500
parents 2e07dc514073
children be9c497e0bfd
line wrap: on
line diff
--- a/mercurial/wireproto.py	Sat Feb 17 01:09:56 2018 -0500
+++ b/mercurial/wireproto.py	Sat Feb 17 01:11:48 2018 -0500
@@ -879,11 +879,11 @@
         # cleanly forward Abort error to the client
         if not exchange.bundle2requested(opts.get('bundlecaps')):
             if proto.name == 'http-v1':
-                return ooberror(str(exc) + '\n')
+                return ooberror(pycompat.bytestr(exc) + '\n')
             raise # cannot do better for bundle1 + ssh
         # bundle2 request expect a bundle2 reply
         bundler = bundle2.bundle20(repo.ui)
-        manargs = [('message', str(exc))]
+        manargs = [('message', pycompat.bytestr(exc))]
         advargs = []
         if exc.hint is not None:
             advargs.append(('hint', exc.hint))