[ python-Bugs-853061 ] Inconsistent behavior of compressing the BZip2 format

SourceForge.net noreply at sourceforge.net
Fri Feb 13 14:18:15 EST 2004


Bugs item #853061, was opened at 2003-12-03 12:43
Message generated for change (Settings changed) made by quiver
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=853061&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: George Yoshida (quiver)
Assigned to: Gustavo Niemeyer (niemeyer)
>Summary: Inconsistent behavior of compressing the BZip2 format

Initial Comment:
There are three ways to compress data in bz2 but they 
don't handle an empty string same way.
BZ2File and compress can accept an empty string but 
BZ2Compressor raises ValueError.

>>> import bz2
>>> bz2f = bz2.BZ2File('test', 'w')
>>> bz2f.write('')
>>> bz2f.close()
>>> bz2.compress('')
'BZh9\x17rE8P\x90\x00\x00\x00\x00'
>>> bz2c = bz2.BZ2Compressor()
>>> bz2c.compress('')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: the bz2 library has received wrong 
parameters



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=853061&group_id=5470



More information about the Python-bugs-list mailing list