summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2012-07-25 09:33:02 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2012-07-25 09:33:02 (GMT)
commit099414875bdfc7eaf5a7c84ab34cd24a489b419e (patch)
treed6a739f240598d511aecf0f77297d0cc65bb4c5b
parentf4b341b0e6fa19e2ae88df754081a24ef1eaf033 (diff)
parent30d5e6c13fc988af2a6c0f8f0cdf43092c241e8f (diff)
downloadcpython-099414875bdfc7eaf5a7c84ab34cd24a489b419e.zip
cpython-099414875bdfc7eaf5a7c84ab34cd24a489b419e.tar.gz
cpython-099414875bdfc7eaf5a7c84ab34cd24a489b419e.tar.bz2
merge 3.2
-rw-r--r--Lib/idlelib/NEWS.txt2
-rw-r--r--Lib/idlelib/OutputWindow.py1
-rw-r--r--Lib/idlelib/PyShell.py7
3 files changed, 7 insertions, 3 deletions
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index 6b430b5..1d87443 100644
--- 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
index 565cc9b..cba9013 100644
--- a/Lib/idlelib/OutputWindow.py
+++ b/Lib/idlelib/OutputWindow.py
@@ -40,6 +40,7 @@ class OutputWindow(EditorWindow):
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
index 0a05d78..e0b8c29 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -764,7 +764,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
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 @@ class PyShell(OutputWindow):
'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 @@ class PyShell(OutputWindow):
self.canceled = 0
if not use_subprocess:
raise KeyboardInterrupt
+ return count
class PseudoFile(object):
@@ -1265,7 +1266,7 @@ class PseudoFile(object):
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: