projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c912a3a
)
Support sizehint in StringIO.readlines, as documented.
author
Martin v. Löwis
<martin@v.loewis.de>
Tue, 19 Sep 2000 11:07:44 +0000
(11:07 +0000)
committer
Martin v. Löwis
<martin@v.loewis.de>
Tue, 19 Sep 2000 11:07:44 +0000
(11:07 +0000)
Lib/StringIO.py
patch
|
blob
|
history
diff --git
a/Lib/StringIO.py
b/Lib/StringIO.py
index 8efd7d8c48f9f733a3c6ad74c4b9905b2019ce0f..02eb7c8bec9483db482966f13adeeffd2d75e21b 100644
(file)
--- a/
Lib/StringIO.py
+++ b/
Lib/StringIO.py
@@
-91,11
+91,15
@@
class StringIO:
r = self.buf[self.pos:newpos]
self.pos = newpos
return r
- def readlines(self):
+ def readlines(self, sizehint = 0):
+ total = 0
lines = []
line = self.readline()
while line:
lines.append(line)
+ total += len(line)
+ if 0 < sizehint <= total:
+ break
line = self.readline()
return lines
def write(self, s):