[gimp] Issue #8734: Python-fu misses sys.stdout.flush.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #8734: Python-fu misses sys.stdout.flush.
- Date: Wed, 12 Oct 2022 21:41:30 +0000 (UTC)
commit 2080abf0a3038be9875264139629858c1bd14b51
Author: Jehan <jehan girinstud io>
Date: Wed Oct 12 23:40:04 2022 +0200
Issue #8734: Python-fu misses sys.stdout.flush.
Just add a no-op flush() as I think it's actually unneeded in the context of a
GtkTextView GUI. At least it doesn't cause issues with copy-pasted code or when
using external libraries using the sys.stdout.flush() interface.
plug-ins/python/python-console/pyconsole.py | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/plug-ins/python/python-console/pyconsole.py b/plug-ins/python/python-console/pyconsole.py
index ab0ee2d306..c923e36248 100644
--- a/plug-ins/python/python-console/pyconsole.py
+++ b/plug-ins/python/python-console/pyconsole.py
@@ -80,6 +80,14 @@ class _ReadLine(object):
def write(self, text):
pos = self.buffer.get_iter_at_mark(self.buffer.get_insert())
self.buffer.insert_with_tags_by_name(pos, text, self.tag_name)
+ def flush(self):
+ # The output is just a GtkTextBuffer inside a GtkTexView so I
+ # believe it should be always in-sync without needing to be flushed.
+ # Nevertheless someone might be just copy-pasting plug-in code to
+ # test it, for instance. So let's just add a no-op flush() method to
+ # get a similar interface as the real sys.stdout which we overrode.
+ # It avoids useless and unexpected code failure.
+ pass
class History(object):
def __init__(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]