Index: Lib/io.py =================================================================== --- Lib/io.py (révision 65973) +++ Lib/io.py (copie de travail) @@ -180,7 +180,7 @@ opened in a text mode, and for bytes a BytesIO can be used like a file opened in a binary mode. """ - if not isinstance(file, (str, int)): + if not isinstance(file, (str, bytes, int)): raise TypeError("invalid file: %r" % file) if not isinstance(mode, str): raise TypeError("invalid mode: %r" % mode)