Issue #13532: Check that arguments to sys.stdout.write are strings.
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index 278f4f6..a25ca87 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -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):