This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients amcnabb, doerwalter, jcea, lemburg, loewis, martin.panter, vstinner
Date 2015-01-15.08:48:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <54B77EEC.5050503@egenix.com>
In-reply-to <1421296992.32.0.202312696753.issue13881@psf.upfronthosting.co.za>
Content
On 15.01.2015 05:43, Martin Panter wrote:
> 
> New patch that also fixes StreamWriter.writelines() in general for the byte codecs

Could you explain this new undocumented class ?

+class _IncrementalBasedWriter(StreamWriter):
+    """Generic StreamWriter implementation.
+
+        The _EncoderClass attribute must be set to an IncrementalEncoder
+        class to use.
+    """
+
+    def __init__(self, stream, errors='strict'):
+        super().__init__(stream, errors)
+        self._encoder = self._Encoder(errors)
+
+    def write(self, object):
+        self.stream.write(self._encoder.encode(object))
+
+    def reset(self):
+        self.stream.write(self._encoder.encode(final=True))
+

Note that the doc-string mentions a non-existing attribute and there
are doc-string missing for the other methods.

The purpose appears to be a StreamWriter which works with
an IncrementalEncoder. A proper name would thus be
IncrementalStreamWriter which provides an .encode()
method which adapts the signature of the incremental encoder
to the one expected for StreamWriters and Codecs.
History
Date User Action Args
2015-01-15 08:48:52lemburgsetrecipients: + lemburg, loewis, doerwalter, jcea, amcnabb, vstinner, martin.panter
2015-01-15 08:48:52lemburglinkissue13881 messages
2015-01-15 08:48:52lemburgcreate