diff --git a/mercurial/error.py b/mercurial/error.py
index e7eb67eab53fc33e4ef1998cdc233869cf2840b1_bWVyY3VyaWFsL2Vycm9yLnB5..822202e72f69ecd5fedb5e4658ae68f728286e96_bWVyY3VyaWFsL2Vycm9yLnB5 100644
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -111,8 +111,10 @@
 
     __bytes__ = _tobytes
 
-    def __str__(self):
-        return pycompat.sysstr(self.__bytes__())
+    if pycompat.ispy3:
+
+        def __str__(self):
+            return pycompat.sysstr(self.__bytes__())
 
 
 class HookLoadError(Abort):