New submission from Jim Jewett <[email protected]>:
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 <[email protected]>
<http://bugs.python.org/issue14014>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com