]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
SF bug #1235646: codecs.StreamRecoder.next() now reencodes the data it reads
authorWalter Dörwald <walter@livinglogic.de>
Thu, 1 Sep 2005 11:56:53 +0000 (11:56 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Thu, 1 Sep 2005 11:56:53 +0000 (11:56 +0000)
from the input stream, so that the output is a byte string in the correct
encoding instead of a unicode string.

Lib/codecs.py
Misc/NEWS

index a964f991886094e27646af6b0a5c61ab4f23c590..d972a5191fd74ccb1d72c406540634b8a43ab211 100644 (file)
@@ -556,7 +556,9 @@ class StreamRecoder:
     def next(self):
 
         """ Return the next decoded line from the input stream."""
-        return self.reader.next()
+        data = self.reader.next()
+        data, bytesencoded = self.encode(data, self.errors)
+        return data
 
     def __iter__(self):
         return self
index 307b359a510941474f1f76503781cf13a6345c01..3ac8db452c557c7cdb82fa0996fbca43bef94dde 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -439,6 +439,9 @@ Library
   about illegal code points. The codec now supports PEP 293 style error
   handlers.
 
+- Bug #1235646: ^^codecs.StreamRecoder.next()^^ now reencodes the data it reads
+  from the input stream, so that the output is a byte string in the correct
+  encoding instead of a unicode string.
 
 Build
 -----