comparison mercurial/statprof.py @ 31091:2912b06905dc

py3: use pycompat.fsencode() to convert __file__ to bytes __file__ returns unicodes on Python 3. This patch uses pycompat.fsencode() to convert them to bytes.
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 20 Feb 2017 18:40:42 +0530
parents cb440e7af05d
children bd872f64a8ba
comparison
equal deleted inserted replaced
31090:2cf1e5207fdf 31091:2912b06905dc
722 removing whatever part of the Python search path it was found 722 removing whatever part of the Python search path it was found
723 on.''' 723 on.'''
724 724
725 if path in _pathcache: 725 if path in _pathcache:
726 return _pathcache[path] 726 return _pathcache[path]
727 hgpath = encoding.__file__.rsplit(os.sep, 2)[0] 727 hgpath = pycompat.fsencode(encoding.__file__).rsplit(os.sep, 2)[0]
728 for p in [hgpath] + sys.path: 728 for p in [hgpath] + sys.path:
729 prefix = p + os.sep 729 prefix = p + os.sep
730 if path.startswith(prefix): 730 if path.startswith(prefix):
731 path = path[len(prefix):] 731 path = path[len(prefix):]
732 break 732 break