[New-bugs-announce] [issue14014] codecs.StreamWriter.reset contract not fulfilled
Jim Jewett
report at bugs.python.org
Tue Feb 14 19:01:53 CET 2012
New submission from Jim Jewett <jimjjewett at gmail.com>:
def reset(self):
""" Flushes and resets the codec buffers used for keeping state.
Calling this method should ensure that the data on the
output is put into a clean state, that allows appending
of new fresh data without having to rescan the whole
stream to recover state.
"""
pass
This does not ensure that the stream is flushed, as the docstring promises. I believe the following would work better.
def reset(self):
""" Flushes and resets the codec buffers used for keeping state.
Calling this method should ensure that the data on the
output is put into a clean state, that allows appending
of new fresh data without having to rescan the whole
stream to recover state.
"""
if hasattr(self.stream, "flush"): self.stream.flush()
----------
components: Unicode
messages: 153354
nosy: Jim.Jewett, ezio.melotti
priority: normal
severity: normal
status: open
title: codecs.StreamWriter.reset contract not fulfilled
type: behavior
versions: Python 3.2
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14014>
_______________________________________
More information about the New-bugs-announce
mailing list