From: Gustavo Niemeyer Date: Sat, 14 Feb 2004 00:02:45 +0000 (+0000) Subject: - Fixed #853061: allow BZ2Compressor.compress() to receive an empty string X-Git-Tag: v2.4a1~820 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6e436e4b4f94062f274746fc5d109e4203bf658;p=thirdparty%2FPython%2Fcpython.git - Fixed #853061: allow BZ2Compressor.compress() to receive an empty string as parameter. --- diff --git a/Misc/NEWS b/Misc/NEWS index 275593b6e35e..47e2859aab83 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -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 82d35ae32ba2..c75011d492a6 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,