D6782: py3: use pycompat.sysargv[0] for instead of fsencode(sys.argv[0])

Yuya Nishihara yuya at tcha.org
Thu Sep 5 19:16:19 EDT 2019


> @@ -245,8 +245,11 @@
>              pycompat.fsencode(getattr(mainmod, '__file__', ''))) == 'hg'):
>              _sethgexecutable(pycompat.fsencode(mainmod.__file__))
>          else:
> -            exe = findexe('hg') or os.path.basename(sys.argv[0])
> -            _sethgexecutable(pycompat.fsencode(exe))
> +            exe = findexe('hg')
> +            if exe:
> +                _sethgexecutable(pycompat.fsencode(exe))
> +            else:
> +                _sethgexecutable(os.path.basename(pycompat.sysargv[0]))

`findexe()` is supposed to return bytes. If not always, it's the bug
of `findexe()`.


More information about the Mercurial-devel mailing list