From: Guido van Rossum Date: Thu, 25 Jan 1996 17:34:14 +0000 (+0000) Subject: fix default arg for read() -- should be -1 X-Git-Tag: v1.4b1~390 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7476c5088e6f459f866901219e1b5b084fb0750;p=python fix default arg for read() -- should be -1 --- diff --git a/Lib/StringIO.py b/Lib/StringIO.py index 90f848a4d5..12d19a1cbf 100644 --- a/Lib/StringIO.py +++ b/Lib/StringIO.py @@ -48,8 +48,8 @@ class StringIO: self.pos = max(0, pos) def tell(self): return self.pos - def read(self, n = 0): - if n <= 0: + def read(self, n = -1): + if n < 0: newpos = len(self.buf) else: newpos = min(self.pos+n, len(self.buf))