]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
- Fixed #853061: allow BZ2Compressor.compress() to receive an empty string
authorGustavo Niemeyer <gustavo@niemeyer.net>
Sat, 14 Feb 2004 00:02:45 +0000 (00:02 +0000)
committerGustavo Niemeyer <gustavo@niemeyer.net>
Sat, 14 Feb 2004 00:02:45 +0000 (00:02 +0000)
  as parameter.

Misc/NEWS
Modules/bz2module.c

index 275593b6e35ebd420ce9f04e830c2db32f5095a5..47e2859aab83f1f3a213fce1e54e0ca799f35100 100644 (file)
--- 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
 -------
 
index 82d35ae32ba219fc49029ce48b4ffd52edbd87e6..c75011d492a6a53517d29a3f4dfbc81819be1f08 100644 (file)
@@ -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,