Support sizehint in _fileobject.readlines, as documented.
This commit is contained in:
parent
543f2438ba
commit
6df27f8d1c
|
@ -228,10 +228,14 @@ class _fileobject:
|
|||
data, self._rbuf = self._rbuf[:i], self._rbuf[i:]
|
||||
return data
|
||||
|
||||
def readlines(self):
|
||||
def readlines(self, sizehint = 0):
|
||||
total = 0
|
||||
list = []
|
||||
while 1:
|
||||
line = self.readline()
|
||||
if not line: break
|
||||
list.append(line)
|
||||
total += len(line)
|
||||
if sizehint and total >= sizehint:
|
||||
break
|
||||
return list
|
||||
|
|
Loading…
Reference in New Issue