py3: fix several TypeError formatting bytes with an exception object stable
authorDenis Laxalde <denis.laxalde@logilab.fr>
Tue, 10 Dec 2019 20:35:56 +0100
branchstable
changeset 4999 a9457b9aca4e
parent 4998 88b816a9d990
child 5000 8d38ad9c044f
child 5001 cb78c6efbbdb
py3: fix several TypeError formatting bytes with an exception object
hgext3rd/evolve/obsdiscovery.py
--- a/hgext3rd/evolve/obsdiscovery.py	Fri Oct 11 21:32:27 2019 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Tue Dec 10 20:35:56 2019 +0100
@@ -33,6 +33,7 @@
     util,
 )
 from mercurial.i18n import _
+from mercurial.utils import stringutil
 
 from . import (
     compat,
@@ -447,7 +448,9 @@
                             for r in ranges:
                                 self._data.pop(r, None)
                     except (sqlite3.DatabaseError, sqlite3.OperationalError) as exc:
-                        repo.ui.log(b'evoext-cache', b'error while updating obshashrange cache: %s' % exc)
+                        repo.ui.log(b'evoext-cache',
+                                    b'error while updating obshashrange cache: %s'
+                                    % stringutil.forcebytestr(exc))
                         del self._updating
                         return
 
@@ -551,8 +554,11 @@
             if r'_con' in vars(self):
                 del self._con
             self._new.clear()
-            repo.ui.log(b'evoext-cache', b'error while saving new data: %s' % exc)
-            repo.ui.debug(b'evoext-cache: error while saving new data: %s' % exc)
+            repo.ui.log(b'evoext-cache',
+                        b'error while saving new data: %s'
+                        % stringutil.forcebytestr(exc))
+            repo.ui.debug(b'evoext-cache: error while saving new data: %s'
+                          % stringutil.forcebytestr(exc))
 
     def _trysave(self, repo):
         if self._con is None: