[Python-3000] Zlib compress/decompress returning bytearray
Georg Brandl
g.brandl at gmx.net
Sat Aug 2 01:24:00 CEST 2008
Anand Balachandran Pillai schrieb:
> Try this in Python 3.0 trunk.
>
>>>> import zlib
>>>> s='This is a string'
>>>> sc=zlib.compress(s)
>>>> sc
> bytearray(b'x\x9c\x0b\xc9\xc8,V\x00\xa2D\x85\xe2\x92\xa2\xcc\xbct\x00/\xc2\x05\xcd')
>>>> zlib.decompress(sc)
> bytearray(b'This is a string')
>>>>
>
> This is wrong behavior as compress functions should return byte
> ,not a bytearray. Same for decompress.
>
> Saw this while trying to write a patch for #3382.
> Shall I file an issue ?
I also wonder why compress() takes a Unicode string.
Georg
More information about the Python-3000
mailing list