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 authored and Patrick committed 2023-04-03 12:29:22 -05:00
1 parent c48afe3799
commit 847e5a14d6
1 file changed
+4
+4
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