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 <[email protected]>
This commit is contained in:
Celelibi
2023-04-03 12:29:22 -05:00
committed by Patrick
parent c48afe3799
commit 847e5a14d6
+4
View File
@@ -64,6 +64,10 @@ class Stdout:
else: else:
self.buffer += string self.buffer += string
def flush(self):
lib.hexchat_print(lib.ph, bytes(self.buffer))
self.buffer = bytearray()
def isatty(self): def isatty(self):
return False return False