changeset 36347:be9c497e0bfd

wireproto: fix lingering str(exception) with util.forcebytestr(exception) Differential Revision: https://phab.mercurial-scm.org/D2342
author Augie Fackler <augie@google.com>
date Sun, 18 Feb 2018 14:43:55 -0500
parents 3f98634b6572
children 398e96f77aa3
files mercurial/wireproto.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/wireproto.py	Sun Feb 18 14:37:36 2018 -0500
+++ b/mercurial/wireproto.py	Sun Feb 18 14:43:55 2018 -0500
@@ -927,7 +927,7 @@
         r = c.hex()
         success = 1
     except Exception as inst:
-        r = str(inst)
+        r = util.forcebytestr(inst)
         success = 0
     return bytesresponse('%d %s\n' % (success, r))
 
@@ -1055,12 +1055,13 @@
                 if exc.params:
                     errpart.addparam('params', '\0'.join(exc.params))
             except error.Abort as exc:
-                manargs = [('message', str(exc))]
+                manargs = [('message', util.forcebytestr(exc))]
                 advargs = []
                 if exc.hint is not None:
                     advargs.append(('hint', exc.hint))
                 bundler.addpart(bundle2.bundlepart('error:abort',
                                                    manargs, advargs))
             except error.PushRaced as exc:
-                bundler.newpart('error:pushraced', [('message', str(exc))])
+                bundler.newpart('error:pushraced',
+                                [('message', util.forcebytestr(exc))])
             return streamres_legacy(gen=bundler.getchunks())