Flush the stdout buffer after printing a line

Pointed out in #2490, this is a regression introduced by #2398. We need to
flush the buffer to faithfully emulate the "real" print() function.
This commit is contained in:
Adrian Sampson 2017-03-26 17:16:42 -04:00
parent 920784a42d
commit 9446ec7f46

View file

@ -148,6 +148,7 @@ def print_(*strings, **kwargs):
if hasattr(sys.stdout, 'buffer'):
out = txt.encode(_out_encoding(), 'replace')
sys.stdout.buffer.write(out)
sys.stdout.buffer.flush()
else:
# In our test harnesses (e.g., DummyOut), sys.stdout.buffer
# does not exist. We instead just record the text string.