diff --git a/hgext/fastannotate/context.py b/hgext/fastannotate/context.py
index 34ef6a5a7bcd90a02c060987c55d3024d9af676c_aGdleHQvZmFzdGFubm90YXRlL2NvbnRleHQucHk=..2df3271ef1396806e65afde31dcf357434757ca0_aGdleHQvZmFzdGFubm90YXRlL2NvbnRleHQucHk= 100644
--- a/hgext/fastannotate/context.py
+++ b/hgext/fastannotate/context.py
@@ -23,6 +23,9 @@
     scmutil,
     util,
 )
+from mercurial.utils import (
+    stringutil,
+)
 
 from . import (
     error as faerror,
@@ -131,7 +134,7 @@
             .replace('.lock/', '.lock.hg/'))
 
 def hashdiffopts(diffopts):
-    diffoptstr = str(sorted(
+    diffoptstr = stringutil.pprint(sorted(
         (k, getattr(diffopts, k))
         for k in mdiff.diffopts.defaults
     ))
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
index 34ef6a5a7bcd90a02c060987c55d3024d9af676c_dGVzdHMvdGVzdC1jaGVjay1weTMtY29tcGF0LnQ=..2df3271ef1396806e65afde31dcf357434757ca0_dGVzdHMvdGVzdC1jaGVjay1weTMtY29tcGF0LnQ= 100644
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -31,11 +31,6 @@
   > | sed 's|\\|/|g' | xargs python3 contrib/check-py3-compat.py \
   > | sed 's/[0-9][0-9]*)$/*)/'
   hgext/convert/transport.py: error importing: <*Error> No module named 'svn.client' (error at transport.py:*) (glob) (?)
-  hgext/fastannotate/commands.py: error importing: <TypeError> Unicode-objects must be encoded before hashing (error at context.py:*)
-  hgext/fastannotate/context.py: error importing: <TypeError> Unicode-objects must be encoded before hashing (error at context.py:*)
-  hgext/fastannotate/formatter.py: error importing: <TypeError> Unicode-objects must be encoded before hashing (error at context.py:*)
-  hgext/fastannotate/protocol.py: error importing: <TypeError> Unicode-objects must be encoded before hashing (error at context.py:*)
-  hgext/fastannotate/support.py: error importing: <TypeError> Unicode-objects must be encoded before hashing (error at context.py:*)
   hgext/infinitepush/sqlindexapi.py: error importing: <*Error> No module named 'mysql' (error at sqlindexapi.py:*) (glob) (?)
   mercurial/scmwindows.py: error importing: <ValueError> _type_ 'v' not supported (error at win32.py:*) (no-windows !)
   mercurial/win32.py: error importing: <ValueError> _type_ 'v' not supported (error at win32.py:*) (no-windows !)