mercurial/wireprotoserver.py
branchstable
changeset 46697 71443f742886
parent 45818 b7b8a1538161
child 46819 d4ba4d51f85f
--- a/mercurial/wireprotoserver.py	Thu Mar 11 21:02:03 2021 -0500
+++ b/mercurial/wireprotoserver.py	Thu Mar 11 21:07:04 2021 -0500
@@ -24,6 +24,7 @@
 from .utils import (
     cborutil,
     compression,
+    stringutil,
 )
 
 stringio = util.stringio
@@ -233,10 +234,12 @@
     except hgwebcommon.ErrorResponse as e:
         for k, v in e.headers:
             res.headers[k] = v
-        res.status = hgwebcommon.statusmessage(e.code, pycompat.bytestr(e))
+        res.status = hgwebcommon.statusmessage(
+            e.code, stringutil.forcebytestr(e)
+        )
         # TODO This response body assumes the failed command was
         # "unbundle." That assumption is not always valid.
-        res.setbodybytes(b'0\n%s\n' % pycompat.bytestr(e))
+        res.setbodybytes(b'0\n%s\n' % stringutil.forcebytestr(e))
 
     return True