python: add flush() to Stdout

Python sometime calls flush() on sys.stdout or sys.stderr.
In particular, it might do so when an exception is raised. This fixes
the second error message that was generated in such cases.

Signed-off-by: Celelibi <celelibi@gmail.com>
This commit is contained in:
Celelibi 2023-04-03 05:22:12 +02:00 committed by Patrick
parent c48afe3799
commit 847e5a14d6

View File

@ -64,6 +64,10 @@ class Stdout:
else:
self.buffer += string
def flush(self):
lib.hexchat_print(lib.ph, bytes(self.buffer))
self.buffer = bytearray()
def isatty(self):
return False