[Python-checkins] cpython (merge 3.2 -> default): merge 3.2

martin.v.loewis python-checkins at python.org
Wed Jul 25 11:33:16 CEST 2012


http://hg.python.org/cpython/rev/1da53d86d722
changeset:   78277:1da53d86d722
parent:      78274:cffdb7d76691
parent:      78276:f72965374b2a
user:        Martin v. Löwis <martin at v.loewis.de>
date:        Wed Jul 25 11:33:02 2012 +0200
summary:
  merge 3.2

files:
  Lib/idlelib/NEWS.txt        |  2 ++
  Lib/idlelib/OutputWindow.py |  1 +
  Lib/idlelib/PyShell.py      |  7 ++++---
  3 files changed, 7 insertions(+), 3 deletions(-)


diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -1,6 +1,8 @@
 What's New in IDLE 3.3.0?
 =========================
 
+- Issue #7163: Propagate return value of sys.stdout.write.
+
 - Issue #15318: Prevent writing to sys.stdin.
 
 - Issue #4832: Modify IDLE to save files with .py extension by
diff --git a/Lib/idlelib/OutputWindow.py b/Lib/idlelib/OutputWindow.py
--- a/Lib/idlelib/OutputWindow.py
+++ b/Lib/idlelib/OutputWindow.py
@@ -40,6 +40,7 @@
         self.text.insert(mark, s, tags)
         self.text.see(mark)
         self.text.update()
+        return len(s)
 
     def writelines(self, lines):
         for line in lines:
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -764,7 +764,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(
@@ -1245,7 +1245,7 @@
                                      'Non-BMP character not supported in Tk')
         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
@@ -1254,6 +1254,7 @@
             self.canceled = 0
             if not use_subprocess:
                 raise KeyboardInterrupt
+        return count
 
 class PseudoFile(object):
 
@@ -1265,7 +1266,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:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list