Issue 16828: bz2 error on compression of empty string (original) (raw)
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/61032
classification
Title: | bz2 error on compression of empty string | ||
---|---|---|---|
Type: | behavior | Stage: | resolved |
Components: | Extension Modules | Versions: | Python 3.2, Python 3.3, Python 3.4, Python 2.7 |
process
Status: | closed | Resolution: | fixed |
---|---|---|---|
Dependencies: | Superseder: | ||
Assigned To: | nadeem.vawda | Nosy List: | doko, gz, jcea, nadeem.vawda, python-dev |
Priority: | high | Keywords: | 3.3regression |
Created on 2012-12-31 16:58 by gz, last changed 2022-04-11 14:57 by admin. This issue is now closed.
Files | |||
---|---|---|---|
File name | Uploaded | Description | Edit |
bz2_compress_empty_string_trunk.patch | gz,2012-12-31 17:03 | Patch against trunk with tests and fix | review |
bz2_compress_empty_string_27.patch | gz,2012-12-31 17:12 | Patch against 2.7 with same tests and adapted fix |
Messages (6) | ||
---|---|---|
msg178705 - (view) | Author: Martin (gz) * | Date: 2012-12-31 16:58 |
The fix from issue 14398 for >4GB inputs regressed the behaviour when compressing an empty string. Going by issue 853061 the expectation is this should work. The problem was noticed when using the updated Python 2.7 package in Ubuntu Raring caused test failures in the Bazaar suite: <https://bugs.launchpad.net/bzr/+bug/1090043> | ||
msg178706 - (view) | Author: Martin (gz) * | Date: 2012-12-31 17:03 |
On trunk, both the compressor and the standalone function (which uses the compressor) are affected. The easiest fix is rearranging the logic in function shared between BZ2Compressor.compress and BZ2Compressor.flush so the exit on no remaining input for the former case happens before the library call. | ||
msg178707 - (view) | Author: Martin (gz) * | Date: 2012-12-31 17:12 |
On 2.7 only the compress() function is affected, and the fix is much simpler. Just using BZ_FINISH when the input is less then 4GB is sufficient. | ||
msg178826 - (view) | Author: Matthias Klose (doko) * ![]() |
Date: 2013-01-02 16:56 |
looks fine to me. | ||
msg178857 - (view) | Author: Roundup Robot (python-dev) ![]() |
Date: 2013-01-02 22:14 |
New changeset 06a08144af1b by Nadeem Vawda in branch '2.7': Issue #16828: Fix error incorrectly raised by bz2.compress(''). http://hg.python.org/cpython/rev/06a08144af1b New changeset c4a4863b85b2 by Nadeem Vawda in branch '3.2': Issue #16828: Fix error incorrectly raised by bz2.compress(''). http://hg.python.org/cpython/rev/c4a4863b85b2 New changeset 011981143087 by Nadeem Vawda in branch '3.3': Issue #16828: Fix error incorrectly raised by bz2.compress(''). http://hg.python.org/cpython/rev/011981143087 New changeset 93654d0d9b1e by Nadeem Vawda in branch '3.3': Correction: issue #16828 also affects BZ2Compressor.compress(). http://hg.python.org/cpython/rev/93654d0d9b1e New changeset 44cfd43b09f5 by Nadeem Vawda in branch 'default': Issue #16828: Fix error incorrectly raised by bz2.compress(b'') and bz2.BZ2Compressor.compress(b''). http://hg.python.org/cpython/rev/44cfd43b09f5 | ||
msg178858 - (view) | Author: Nadeem Vawda (nadeem.vawda) * ![]() |
Date: 2013-01-02 22:19 |
Fixed. Thanks for the bug report and the patches! |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:57:40 | admin | set | github: 61032 |
2013-01-02 22:19:42 | nadeem.vawda | set | status: open -> closedmessages: + assignee: nadeem.vawdakeywords: + 3.3regression, - patchresolution: fixedstage: patch review -> resolved |
2013-01-02 22:14:31 | python-dev | set | nosy: + python-devmessages: + |
2013-01-02 16:56:55 | doko | set | messages: + |
2013-01-02 16:43:55 | doko | set | nosy: + doko |
2013-01-01 11:56:15 | pitrou | set | priority: normal -> high |
2012-12-31 17:23:22 | serhiy.storchaka | set | stage: patch reviewversions: - Python 3.5 |
2012-12-31 17:12:07 | gz | set | files: + bz2_compress_empty_string_27.patchmessages: + |
2012-12-31 17:06:54 | jcea | set | nosy: + jcea |
2012-12-31 17:03:25 | gz | set | files: + bz2_compress_empty_string_trunk.patchkeywords: + patchmessages: + |
2012-12-31 16:58:04 | gz | create |