diff --git a/hgext/strip.py b/hgext/strip.py
index e14484e7f562f7d4f4def471ea5beb71775e5e11_aGdleHQvc3RyaXAucHk=..799db2af824cabf4096ab30c275628f98afcc35c_aGdleHQvc3RyaXAucHk= 100644
--- a/hgext/strip.py
+++ b/hgext/strip.py
@@ -14,6 +14,7 @@
     lock as lockmod,
     merge,
     node as nodemod,
+    pycompat,
     registrar,
     repair,
     scmutil,
@@ -133,6 +134,7 @@
 
     Return 0 on success.
     """
+    opts = pycompat.byteskwargs(opts)
     backup = True
     if opts.get('no_backup') or opts.get('nobackup'):
         backup = False
diff --git a/mercurial/formatter.py b/mercurial/formatter.py
index e14484e7f562f7d4f4def471ea5beb71775e5e11_bWVyY3VyaWFsL2Zvcm1hdHRlci5weQ==..799db2af824cabf4096ab30c275628f98afcc35c_bWVyY3VyaWFsL2Zvcm1hdHRlci5weQ== 100644
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -354,6 +354,7 @@
         self._cache = {}  # for templatekw/funcs to store reusable data
     def context(self, **ctxs):
         '''insert context objects to be used to render template keywords'''
+        ctxs = pycompat.byteskwargs(ctxs)
         assert all(k == 'ctx' for k in ctxs)
         self._item.update(ctxs)
     def _showitem(self):
diff --git a/mercurial/hook.py b/mercurial/hook.py
index e14484e7f562f7d4f4def471ea5beb71775e5e11_bWVyY3VyaWFsL2hvb2sucHk=..799db2af824cabf4096ab30c275628f98afcc35c_bWVyY3VyaWFsL2hvb2sucHk= 100644
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -205,6 +205,7 @@
     return r
 
 def runhooks(ui, repo, htype, hooks, throw=False, **args):
+    args = pycompat.byteskwargs(args)
     res = {}
     oldstdout = -1