[issue12508] Codecs Anomaly

Marc-Andre Lemburg report at bugs.python.org
Wed Sep 21 13:20:51 CEST 2011


Marc-Andre Lemburg <mal at egenix.com> added the comment:

The final parameter is an extension to the decoder API signature,
so it's not surprising that not all codecs implement it.

The ones that do should use it for all calls, since that way
the actual consumed number of bytes is correctly reported
back to the StreamReader instance.

Note: The parameter name "final" is a bit misleading. What happens
is that the number of bytes consumed by the decoder were previously
always reported as len(buffer), since the C API for decoders did
not provide a way to report back the number of bytes consumed.
This was changed when stateful decoders were added to the C API,
since these do allow reporting back the consumed bytes. A more
appropriate name for the parameter would have been
"report_bytes_consumed".

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12508>
_______________________________________


More information about the Python-bugs-list mailing list