projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
543f243
)
Support sizehint in _fileobject.readlines, as documented.
author
Martin v. Löwis
<martin@v.loewis.de>
Tue, 19 Sep 2000 11:25:58 +0000
(11:25 +0000)
committer
Martin v. Löwis
<martin@v.loewis.de>
Tue, 19 Sep 2000 11:25:58 +0000
(11:25 +0000)
Lib/socket.py
patch
|
blob
|
history
diff --git
a/Lib/socket.py
b/Lib/socket.py
index b28de1d39cad92d463f815b660ea1f89dacd0def..7658c0735d07da8a8ba62bd887a38ec440351022 100644
(file)
--- a/
Lib/socket.py
+++ b/
Lib/socket.py
@@
-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