[PATCH STABLE] ui: remove excessive strtolocal() from debuguigetpass

Augie Fackler raf at durin42.com
Fri Dec 4 22:26:27 UTC 2020


queued for stable, thanks

> On Dec 3, 2020, at 05:06, Yuya Nishihara <yuya at tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1606988543 -32400
> #      Thu Dec 03 18:42:23 2020 +0900
> # Branch stable
> # Node ID 074a20823c4be85d4b98a76c2ba961ff640cc80e
> # Parent  27c23c8f14da48a24a0896b588721c0139e92560
> ui: remove excessive strtolocal() from debuguigetpass
> 
> ui.getpass() returns Optional[bytes], and strtolocal(bytes) would crash.
> Follows up 07b0a687c01a "ui: ensure `getpass()` returns bytes."
> 
> diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
> --- a/mercurial/debugcommands.py
> +++ b/mercurial/debugcommands.py
> @@ -3787,9 +3787,7 @@ def debugtemplate(ui, repo, tmpl, **opts
> def debuguigetpass(ui, prompt=b''):
>     """show prompt to type password"""
>     r = ui.getpass(prompt)
> -    if r is not None:
> -        r = encoding.strtolocal(r)
> -    else:
> +    if r is None:
>         r = b"<default response>"
>     ui.writenoi18n(b'response: %s\n' % r)
> 
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel




More information about the Mercurial-devel mailing list