]> granicus.if.org Git - python/commitdiff
Cleaned how _BytesIO.read() returns an empty bytes object.
authorAlexandre Vassalotti <alexandre@peadrop.com>
Wed, 7 May 2008 00:09:04 +0000 (00:09 +0000)
committerAlexandre Vassalotti <alexandre@peadrop.com>
Wed, 7 May 2008 00:09:04 +0000 (00:09 +0000)
Thank you, Guido, for noticing!

Lib/io.py

index a88b5a41fef5e2658dd8ff1d2675afb79a32f5e6..940c4c776c806d1ad967c41cdaf083aafb94b40c 100644 (file)
--- 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