Mercurial > hg
changeset 43118:57efd5bd2ca2
py3: decode prompt string before calling rawinput
Calling input() (aka pycompat.rawinput() on python3) with a byte string
displays a byte string in the console. E.g. in interactive commit, we
get: b"examine changes to '<file>'?\n(enter ? for help) [Ynesfdaq?]".
Similarly, "hg email" prompts are messed up.
We thus decode the prompt string before running rawinput().
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Wed, 09 Oct 2019 15:28:16 +0200 |
parents | 8ff1ecfadcd1 |
children | c9093ae8d6c4 |
files | mercurial/ui.py |
diffstat | 1 files changed, 1 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/ui.py Tue Oct 08 15:06:18 2019 -0700 +++ b/mercurial/ui.py Wed Oct 09 15:28:16 2019 +0200 @@ -1555,6 +1555,7 @@ # - http://bugs.python.org/issue12833 with self.timeblockedsection(b'stdio'): if usereadline: + prompt = encoding.strfromlocal(prompt) line = encoding.strtolocal(pycompat.rawinput(prompt)) # When stdin is in binary mode on Windows, it can cause # raw_input() to emit an extra trailing carriage return