Issue #6241: Better type checking for the arguments of io.StringIO.
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index bbf65bc..5458f99 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -1924,8 +1924,10 @@
         # C version, even under Windows.
         if newline is None:
             self._writetranslate = False
-        if initial_value:
+        if initial_value is not None:
             if not isinstance(initial_value, str):
+                raise TypeError("initial_value must be str or None, not {0}"
+                                .format(type(initial_value).__name__))
                 initial_value = str(initial_value)
             self.write(initial_value)
             self.seek(0)