diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
index 1e53463139637776e6dacc0177162da5e9b9168e_bWVyY3VyaWFsL3B5Y29tcGF0LnB5..42af0590f4b96e99a3228f76cfad0c9d66d0c5b4_bWVyY3VyaWFsL3B5Y29tcGF0LnB5 100644
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -36,6 +36,7 @@
     import functools
     import os
     fsencode = os.fsencode
+    fsdecode = os.fsdecode
 
     def sysstr(s):
         """Return a keyword str to be passed to Python functions such as
@@ -76,6 +77,11 @@
             raise TypeError(
                 "expect str, not %s" % type(filename).__name__)
 
+    # In Python 2, fsdecode() has a very chance to receive bytes. So it's
+    # better not to touch Python 2 part as it's already working fine.
+    def fsdecode(filename):
+        return filename
+
 stringio = io.StringIO
 empty = _queue.Empty
 queue = _queue.Queue