[Python-Dev] Bug or feature? Unicode vs t# (original) (raw)
M.-A. Lemburg mal@lemburg.com
Thu, 11 Oct 2001 10:13:49 +0200
- Previous message: [Python-Dev] Bug or feature? Unicode vs t#
- Next message: [Python-Dev] Bug or feature? Unicode vs t#
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Tim Peters wrote:
Here in current CVS Python: >>> import binascii >>> binascii.hexlify(u'a') '6100' >>> In 2.1.1, it's '61' instead. I don't know what ought to happen, but 2.1.1 suprised me less. binascii inherits its view of the argument via PyArgParseTuple's t# code.
Neither Unicode nor binascii has changed. For some reason the code in Python/getargs.c was changed in a way which removes the distinctin between "t#" and "s#" -- by delegating the actual buffer conversion to convertbuffer() only the bf_getreadbuffer slot gets used for both cases.
Whether this is right or wrong is a different topic (binascii.hexlify() should probably work on the bf_getreadbuffer slot anyway since its normal usage is to encode binary data using HEX), but the change in getargs.c will certainly break existing code out there...
-- Marc-Andre Lemburg CEO eGenix.com Software GmbH
Consulting & Company: http://www.egenix.com/ Python Software: http://www.lemburg.com/python/
- Previous message: [Python-Dev] Bug or feature? Unicode vs t#
- Next message: [Python-Dev] Bug or feature? Unicode vs t#
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]