From bdefa0b3dec131cdd11bdb4ba9338fc94f53aa7f Mon Sep 17 00:00:00 2001
From: Barry Warsaw <barry@python.org>
Date: Sat, 22 Sep 2001 04:34:54 +0000
Subject: [PATCH] __iter__(): New method so that StringIO's can participate in
 the iterator protocol.

---
 Lib/StringIO.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Lib/StringIO.py b/Lib/StringIO.py
index 2aef3c329e..cb7313d42a 100644
--- a/Lib/StringIO.py
+++ b/Lib/StringIO.py
@@ -45,6 +45,9 @@ class StringIO:
         self.closed = 0
         self.softspace = 0
 
+    def __iter__(self):
+        return iter(self.readline, '')
+
     def close(self):
         if not self.closed:
             self.closed = 1
-- 
2.40.0