- Fixed #853061: allow BZ2Compressor.compress() to receive an empty string
  as parameter.
diff --git a/Misc/NEWS b/Misc/NEWS
index 275593b..47e2859 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -226,6 +226,9 @@
 - 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 @@
 	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,