diff Lib/idlelib/PyShell.py @ 78276:f72965374b2a 3.2

Issue #7163: Propagate return value of sys.stdout.write. Patch by Roger Serwy.
author Martin v. Löwis <martin@v.loewis.de>
date Wed, 25 Jul 2012 11:32:26 +0200
parents a82fd35e28be
children 47536beb7453 1da53d86d722
line wrap: on
line diff
--- a/Lib/idlelib/PyShell.py	Wed Jul 25 10:47:20 2012 +0200
+++ b/Lib/idlelib/PyShell.py	Wed Jul 25 11:32:26 2012 +0200
@@ -760,7 +760,7 @@
 
     def write(self, s):
         "Override base class method"
-        self.tkconsole.stderr.write(s)
+        return self.tkconsole.stderr.write(s)
 
     def display_port_binding_error(self):
         tkMessageBox.showerror(
@@ -1229,7 +1229,7 @@
     def write(self, s, tags=()):
         try:
             self.text.mark_gravity("iomark", "right")
-            OutputWindow.write(self, s, tags, "iomark")
+            count = OutputWindow.write(self, s, tags, "iomark")
             self.text.mark_gravity("iomark", "left")
         except:
             raise ###pass  # ### 11Aug07 KBK if we are expecting exceptions
@@ -1238,6 +1238,7 @@
             self.canceled = 0
             if not use_subprocess:
                 raise KeyboardInterrupt
+        return count
 
 class PseudoFile(object):
 
@@ -1249,7 +1250,7 @@
     def write(self, s):
         if not isinstance(s, str):
             raise TypeError('must be str, not ' + type(s).__name__)
-        self.shell.write(s, self.tags)
+        return self.shell.write(s, self.tags)
 
     def writelines(self, lines):
         for line in lines: