diff options
author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2004-02-14 00:02:45 (GMT) |
---|---|---|
committer | Gustavo Niemeyer <gustavo@niemeyer.net> | 2004-02-14 00:02:45 (GMT) |
commit | a6e436e4b4f94062f274746fc5d109e4203bf658 (patch) | |
tree | 53e5f6dae22726c6714d3bf69d3360aff1c08574 | |
parent | 238b267bf6da6311f7f2b1e6b1ee570f7d482db4 (diff) | |
download | cpython-a6e436e4b4f94062f274746fc5d109e4203bf658.zip cpython-a6e436e4b4f94062f274746fc5d109e4203bf658.tar.gz cpython-a6e436e4b4f94062f274746fc5d109e4203bf658.tar.bz2 |
- Fixed #853061: allow BZ2Compressor.compress() to receive an empty string
as parameter.
-rw-r--r-- | Misc/NEWS | 3 | ||||
-rw-r--r-- | Modules/bz2module.c | 3 |
2 files changed, 6 insertions, 0 deletions
@@ -226,6 +226,9 @@ Extension modules - itertools.izip() with no arguments now returns an empty iterator instead of raising a TypeError exception. +- Fixed #853061: allow BZ2Compressor.compress() to receive an empty string + as parameter. + Library ------- diff --git a/Modules/bz2module.c b/Modules/bz2module.c index 82d35ae..c75011d 100644 --- a/Modules/bz2module.c +++ b/Modules/bz2module.c @@ -1503,6 +1503,9 @@ BZ2Comp_compress(BZ2CompObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "s#", &data, &datasize)) return NULL; + if (datasize == 0) + return PyString_FromString(""); + ACQUIRE_LOCK(self); if (!self->running) { PyErr_SetString(PyExc_ValueError, |