diff Lib/idlelib/PyShell.py @ 78031:422242dbce30 3.2

Issue #13532: Check that arguments to sys.stdout.write are strings.
author Martin v. Löwis <martin@v.loewis.de>
date Mon, 09 Jul 2012 20:46:11 +0200
parents 9d0c3a835bfe
children a82fd35e28be 4915cd0cb7af
line wrap: on
line diff
--- a/Lib/idlelib/PyShell.py	Mon Jul 09 00:13:21 2012 -0400
+++ b/Lib/idlelib/PyShell.py	Mon Jul 09 20:46:11 2012 +0200
@@ -1242,6 +1242,8 @@
         self.encoding = encoding
 
     def write(self, s):
+        if not isinstance(s, str):
+            raise TypeError('must be str, not ' + type(s).__name__)
         self.shell.write(s, self.tags)
 
     def writelines(self, lines):