py3: cast exception to bytes
authorGregory Szorc <gregory.szorc@gmail.com>
Tue, 25 Sep 2018 09:11:56 -0700
changeset 39842 69b4a5b89dc5
parent 39841 f1d6021453c2
child 39843 bce1c1af7518
py3: cast exception to bytes This was raising a TypeError on Python 3 and preventing most (all?) wireprotov2 commands from working. Differential Revision: https://phab.mercurial-scm.org/D4731
mercurial/wireprotov2server.py
--- a/mercurial/wireprotov2server.py	Tue Sep 25 23:25:36 2018 -0400
+++ b/mercurial/wireprotov2server.py	Tue Sep 25 09:11:56 2018 -0700
@@ -29,6 +29,7 @@
 )
 from .utils import (
     interfaceutil,
+    stringutil,
 )
 
 FRAMINGTYPE = b'application/mercurial-exp-framing-0005'
@@ -319,7 +320,8 @@
     except Exception as e:
         action, meta = reactor.onservererror(
             outstream, command['requestid'],
-            _('exception when invoking command: %s') % e)
+            _('exception when invoking command: %s') %
+            stringutil.forcebytestr(e))
 
     if action == 'sendframes':
         res.setbodygen(meta['framegen'])