diff --git a/mercurial/statprof.py b/mercurial/statprof.py --- a/mercurial/statprof.py +++ b/mercurial/statprof.py @@ -766,7 +766,7 @@ if path in _pathcache: return _pathcache[path] - hgpath = pycompat.fsencode(encoding.__file__).rsplit(os.sep, 2)[0] + hgpath = encoding.__file__.rsplit(os.sep, 2)[0] for p in [hgpath] + sys.path: prefix = p + os.sep if path.startswith(prefix):