[Python-3000] Zlib compress/decompress returning bytearray

Anand Balachandran Pillai abpillai at gmail.com
Fri Aug 1 23:29:19 CEST 2008


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 ?

Thanks

-- 
-Anand


More information about the Python-3000 mailing list