diff options
author | Celelibi <celelibi@gmail.com> | 2023-04-03 05:22:12 +0200 |
---|---|---|
committer | Patrick <tingping@tingping.se> | 2023-04-03 12:29:22 -0500 |
commit | 847e5a14d6d7991682c3add853f7b3cc32f935df (patch) | |
tree | 01548a1f8c0ee14b5ca93b00ba6bfb2a873adb5e /plugins/python | |
parent | c48afe3799e648e0ded2bf07deeb082028b6c5ac (diff) |
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>
Diffstat (limited to 'plugins/python')
-rw-r--r-- | plugins/python/python.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/python/python.py b/plugins/python/python.py index 7a794784..07900eb2 100644 --- a/plugins/python/python.py +++ b/plugins/python/python.py @@ -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 |