changeset 33676:9f862fe7a8bd

bundle2: obtain repr() of exception in a python3-safe way This was exposed by other problems in bundle generation, but I'm not sure how to test it for now.
author Augie Fackler <augie@google.com>
date Mon, 24 Jul 2017 11:19:11 -0400
parents 24b7c75c6441
children 644dddccc265
files mercurial/bundle2.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Mon Jul 24 11:28:40 2017 -0400
+++ b/mercurial/bundle2.py	Mon Jul 24 11:19:11 2017 -0400
@@ -1045,11 +1045,12 @@
             ui.debug('bundle2-generatorexit\n')
             raise
         except BaseException as exc:
+            bexc = pycompat.bytestr(exc)
             # backup exception data for later
             ui.debug('bundle2-input-stream-interrupt: encoding exception %s'
-                     % exc)
+                     % bexc)
             tb = sys.exc_info()[2]
-            msg = 'unexpected error: %s' % exc
+            msg = 'unexpected error: %s' % bexc
             interpart = bundlepart('error:abort', [('message', msg)],
                                    mandatory=False)
             interpart.id = 0