mirror of https://github.com/python/cpython
- Fixed #853061: allow BZ2Compressor.compress() to receive an empty string
as parameter.
This commit is contained in:
parent
238b267bf6
commit
a6e436e4b4
|
@ -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
|
||||
-------
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue