summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/PyShell.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2012-07-25 09:32:26 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2012-07-25 09:32:26 (GMT)
commit30d5e6c13fc988af2a6c0f8f0cdf43092c241e8f (patch)
tree2dbc99ce7436b2336806842c1baff29750cbd0ee /Lib/idlelib/PyShell.py
parentc882b7c51ab4b76bdf44cf4dab5ca1b55ccb2155 (diff)
downloadcpython-30d5e6c13fc988af2a6c0f8f0cdf43092c241e8f.zip
cpython-30d5e6c13fc988af2a6c0f8f0cdf43092c241e8f.tar.gz
cpython-30d5e6c13fc988af2a6c0f8f0cdf43092c241e8f.tar.bz2
Issue #7163: Propagate return value of sys.stdout.write.
Patch by Roger Serwy.
Diffstat (limited to 'Lib/idlelib/PyShell.py')
-rw-r--r--Lib/idlelib/PyShell.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index 83d40df..0eae7c5 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -760,7 +760,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(
@@ -1229,7 +1229,7 @@ class PyShell(OutputWindow):
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 @@ class PyShell(OutputWindow):
self.canceled = 0
if not use_subprocess:
raise KeyboardInterrupt
+ return count
class PseudoFile(object):
@@ -1249,7 +1250,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: