diff mercurial/bundle2.py @ 33708:1d5e497c08b3

py3: convert arbitrary exception object to byte string more reliably Our exception types implement __bytes__(), which should be tried first. Do lossy encoding conversion as a last resort.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 03 Aug 2017 23:02:32 +0900
parents 9f862fe7a8bd
children db3dc11356ed
line wrap: on
line diff
--- a/mercurial/bundle2.py	Thu Aug 03 20:08:31 2017 -0700
+++ b/mercurial/bundle2.py	Thu Aug 03 23:02:32 2017 +0900
@@ -1045,7 +1045,7 @@
             ui.debug('bundle2-generatorexit\n')
             raise
         except BaseException as exc:
-            bexc = pycompat.bytestr(exc)
+            bexc = util.forcebytestr(exc)
             # backup exception data for later
             ui.debug('bundle2-input-stream-interrupt: encoding exception %s'
                      % bexc)