File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -299,6 +299,17 @@ def reset(self):
299299 """
300300 pass
301301
302+ def next (self ):
303+
304+ """ Return the next decoded line from the input stream."""
305+ line = self .readline ()
306+ if line :
307+ return line
308+ raise StopIteration
309+
310+ def __iter__ (self ):
311+ return self
312+
302313 def __getattr__ (self , name ,
303314 getattr = getattr ):
304315
@@ -351,6 +362,14 @@ def readlines(self, sizehint=None):
351362
352363 return self .reader .readlines (sizehint )
353364
365+ def next (self ):
366+
367+ """ Return the next decoded line from the input stream."""
368+ return self .reader .next ()
369+
370+ def __iter__ (self ):
371+ return self
372+
354373 def write (self , data ):
355374
356375 return self .writer .write (data )
@@ -451,6 +470,14 @@ def readlines(self, sizehint=None):
451470 data , bytesencoded = self .encode (data , self .errors )
452471 return data .splitlines (1 )
453472
473+ def next (self ):
474+
475+ """ Return the next decoded line from the input stream."""
476+ return self .reader .next ()
477+
478+ def __iter__ (self ):
479+ return self
480+
454481 def write (self , data ):
455482
456483 data , bytesdecoded = self .decode (data , self .errors )
Original file line number Diff line number Diff line change @@ -362,6 +362,9 @@ Extension modules
362362Library
363363-------
364364
365+ - StreamReader, StreamReaderWriter and StreamRecoder in the codecs
366+ modules are iterators now.
367+
365368- gzip.py now handles files exceeding 2GB. Files over 4GB also work
366369 now (provided the OS supports it, and Python is configured with large
367370 file support), but in that case the underlying gzip file format can
You can’t perform that action at this time.
0 commit comments