summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/StringIO.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/StringIO.py b/Lib/StringIO.py
index 79ab7e1..89dda5e 100644
--- a/Lib/StringIO.py
+++ b/Lib/StringIO.py
@@ -59,7 +59,15 @@ class StringIO:
self.softspace = 0
def __iter__(self):
- return iter(self.readline, '')
+ return self
+
+ def next(self):
+ if self.closed:
+ raise StopIteration
+ r = self.readline()
+ if not r:
+ raise StopIteration
+ return r
def close(self):
"""Free the memory buffer.