Index: Lib/io.py =================================================================== --- Lib/io.py (revision 57068) +++ Lib/io.py (working copy) @@ -588,7 +588,9 @@ def __init__(self, initial_bytes=None): buffer = b"" - if initial_bytes is not None: + if isinstance(initial_bytes, str): + buffer += bytes(initial_bytes) + elif initial_bytes is not None: buffer += initial_bytes self._buffer = buffer self._pos = 0