diff options
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 4 |
1 files changed, 3 insertions, 1 deletions
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 @@ class StringIO(TextIOWrapper): # 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) |