Bug#764380: A closer look

John Wright jsw at debian.org
Tue Oct 21 06:50:58 UTC 2014


Hi Stephan and Stuart,

On Mon, Oct 13, 2014 at 05:07:43PM +0200, Stephan Sürken wrote:
> Hi Stuart,
> 
> thanks for pointing to the commit.
> 
> I had a closer look; it's this compat include
> 
> ---
> try:
>     from StringIO import StringIO
>     BytesIO = StringIO
> except ImportError:
>     from io import BytesIO, StringIO
> ---
> 
> that previously made it work.
> 
> Using io.open() implicitly makes the "split_gpg_and_payload" produce
> unicode strings. Then finally code like this
> 
> ---
> io.BytesIO().write(b"\n".join([u"unicode string"]))
> ---
> 
> is run (and fails).
> 
> Fwiw, for python3 "split_gpg_and_payload" implicitly produces 'bytes',
> and everything works fine.
> 
> Not really sure though what a good fix could be ;).

Thanks for the report and investigation.  Unicode handling in deb822 has
been the bane of my existence, and this is no exception.  I have a
proposed fix for this that involves trying to figure out the encoding
from the input object's 'encoding' property, or failing that, the
'encoding' kwarg, and encoding each element of the sequence.  Will send
that to the list (or maybe just upload, since it's fairly simple and
this is pretty broken) hopefully tomorrow.

-- 
John Wright <jsw at debian.org>



More information about the pkg-python-debian-maint mailing list