# HG changeset patch # User Gregory Szorc # Date 2019-11-02 22:33:39 # Node ID aaa046919043f77b17d0bb1504723ac9a56ccfc3 # Parent b27cf9f521943561d15623f3627dd48532f00740 ui: flush before prompting for input with readline I was using `hg absorb` with Python 3 and noticed that the prompt was appearing without any output about what would be done. After I answered the prompt, the output was printed to stdout. This appears to be a buffering difference between Python 2 and Python 3. To work around it, this commit adds an explicit flush() before calling the raw input function when readline is used. diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1564,6 +1564,7 @@ class ui(object): # - http://bugs.python.org/issue12833 with self.timeblockedsection(b'stdio'): if usereadline: + self.flush() prompt = encoding.strfromlocal(prompt) line = encoding.strtolocal(pycompat.rawinput(prompt)) # When stdin is in binary mode on Windows, it can cause