mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
fix default arg for read() -- should be -1
This commit is contained in:
parent
06d74418e5
commit
f7476c5088
1 changed files with 2 additions and 2 deletions
|
@ -48,8 +48,8 @@ class StringIO:
|
||||||
self.pos = max(0, pos)
|
self.pos = max(0, pos)
|
||||||
def tell(self):
|
def tell(self):
|
||||||
return self.pos
|
return self.pos
|
||||||
def read(self, n = 0):
|
def read(self, n = -1):
|
||||||
if n <= 0:
|
if n < 0:
|
||||||
newpos = len(self.buf)
|
newpos = len(self.buf)
|
||||||
else:
|
else:
|
||||||
newpos = min(self.pos+n, len(self.buf))
|
newpos = min(self.pos+n, len(self.buf))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue