[issue12808] Coverage of codecs.py

Marc-Andre Lemburg report at bugs.python.org
Mon Aug 22 14:36:21 CEST 2011


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

Tennessee Leeuwenburg wrote:
> 
> Tennessee Leeuwenburg <tleeuwenburg at gmail.com> added the comment:
> 
> Some more tests, updated initial state of BufferedIncrementalEncoder to be the correct type, updated rst file. Bit tired, hope I got it right!
> 
> Thanks for the feedback everyone, helps me to get it done, even if it's more work for you...

I think you should simply drop this whole part:

"""
The implementation should make sure that ``0`` is the most common state. (States
that are more complicated than integers can be converted into an integer by
marshaling/pickling the state and encoding the bytes of the resulting string
into an integer).
"""

or, better, rephrase it so that it becomes clear that the codec
implementation may use any type of pickleable object to represent
the internal state. The only requirement is that .setstate()
has to be able to read back the state returned by .getstate().

We have codecs in the stdlib that return integers, bytes/string
and even tuples (see the io module and the UTF-16 codec as example),
so the documentation is clearly wrong.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

________________________________________________________________________
2011-10-04: PyCon DE 2011, Leipzig, Germany                43 days to go

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/

----------

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


More information about the Python-bugs-list mailing list