FULL_FLUSH and SYNC_FLUSH flush modes are ignored
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PylibLZMA |
New
|
Undecided
|
Unassigned |
Bug Description
Version = 0.5.3
The LZMA_FULL_FLUSH and LZMA_SYNC_FLUSH modes for LZMACompressor.
The following Python code demonstrates the issue.
>>> compressor = LZMACompressor()
>>> header = compressor.
>>> preflush = header + compressor.
>>> compressor.
''
>>> postflush = header + compressor.
>>> print lzma.decompress
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: unknown BUF error
>>> print lzma.decompress
Pre-flush text
Post-flush text
If the flush works as expected, preflush should decompress to "Pre-flush text" and postflush should decompress to "Post-flush text".
Looking at the source code file liblzma_
switch(
case(
case(
if(self-
PyErr_
goto error;
}
/* Flushing with LZMA_RUN is a no-op, so there's no point in
* doing any work at all; just return an empty string.
*/
case(LZMA_RUN):
ret = PyString_
goto error;
case(
break;
default:
PyErr_
goto error;
}
Simply adding a 'break' after the FULL_FLUSH case will not by itself fix the problem because the first line after the switch statement sets the compressor as no longer running.