Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0994148

Browse files
committed
merge 3.2
2 parents f4b341b + 30d5e6c commit 0994148

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

Lib/idlelib/NEWS.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
What's New in IDLE 3.3.0?
22
=========================
33

4+
- Issue #7163: Propagate return value of sys.stdout.write.
5+
46
- Issue #15318: Prevent writing to sys.stdin.
57

68
- Issue #4832: Modify IDLE to save files with .py extension by

Lib/idlelib/OutputWindow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def write(self, s, tags=(), mark="insert"):
4040
self.text.insert(mark, s, tags)
4141
self.text.see(mark)
4242
self.text.update()
43+
return len(s)
4344

4445
def writelines(self, lines):
4546
for line in lines:

Lib/idlelib/PyShell.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ def runcode(self, code):
764764

765765
def write(self, s):
766766
"Override base class method"
767-
self.tkconsole.stderr.write(s)
767+
return self.tkconsole.stderr.write(s)
768768

769769
def display_port_binding_error(self):
770770
tkMessageBox.showerror(
@@ -1245,7 +1245,7 @@ def write(self, s, tags=()):
12451245
'Non-BMP character not supported in Tk')
12461246
try:
12471247
self.text.mark_gravity("iomark", "right")
1248-
OutputWindow.write(self, s, tags, "iomark")
1248+
count = OutputWindow.write(self, s, tags, "iomark")
12491249
self.text.mark_gravity("iomark", "left")
12501250
except:
12511251
raise ###pass # ### 11Aug07 KBK if we are expecting exceptions
@@ -1254,6 +1254,7 @@ def write(self, s, tags=()):
12541254
self.canceled = 0
12551255
if not use_subprocess:
12561256
raise KeyboardInterrupt
1257+
return count
12571258

12581259
class PseudoFile(object):
12591260

@@ -1265,7 +1266,7 @@ def __init__(self, shell, tags, encoding=None):
12651266
def write(self, s):
12661267
if not isinstance(s, str):
12671268
raise TypeError('must be str, not ' + type(s).__name__)
1268-
self.shell.write(s, self.tags)
1269+
return self.shell.write(s, self.tags)
12691270

12701271
def writelines(self, lines):
12711272
for line in lines:

0 commit comments

Comments
 (0)