From: Alexandre Vassalotti Date: Wed, 7 May 2008 00:09:04 +0000 (+0000) Subject: Cleaned how _BytesIO.read() returns an empty bytes object. X-Git-Tag: v3.0a5~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e0419dcd69cab245d30b92a7f442fd4617ca8f8;p=python Cleaned how _BytesIO.read() returns an empty bytes object. Thank you, Guido, for noticing! --- diff --git a/Lib/io.py b/Lib/io.py index a88b5a41fe..940c4c776c 100644 --- a/Lib/io.py +++ b/Lib/io.py @@ -794,7 +794,7 @@ class _BytesIO(BufferedIOBase): if n < 0: n = len(self._buffer) if len(self._buffer) <= self._pos: - return bytes(self._buffer[:0]) + return b"" newpos = min(len(self._buffer), self._pos + n) b = self._buffer[self._pos : newpos] self._pos = newpos