[issue10783] struct.pack() and Unicode strings

STINNER Victor report at bugs.python.org
Tue Dec 28 10:07:13 CET 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

Amaury> At this point a feature change seems unlikely,
Amaury> but it's not too late to emit a DeprecationWarning.

I prefer to break the API today than having to maintain a broken API for
10 or 20 years :-)  And we have a very small user base using Python 3,
it's easier to change it now, than in the next release.

Amaury> But there are probably working usages with unicode strings out
Amaury> there. For example, I've seen code like
Amaury> struct.pack('<6sHHBBB','GIF87a', ...)
Amaury> Do you suggest to make this 3.1 code stop working in 3.2?

Yes. As I wrote in my previous message, this can be changed to
struct.pack('<6sHHBBB', b'GIF87a', ...), which works on 3.1 and 3.2
(patched).

----------

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


More information about the Python-bugs-list mailing list