--- zlibmodule.c.orig 2009年02月11日 16:07:03.000000000 -0600 +++ zlibmodule.c 2009年02月12日 10:22:05.712678051 -0600 @@ -66,6 +66,7 @@ z_stream zst; PyObject *unused_data; PyObject *unconsumed_tail; + PyObject *is_finished; int is_initialised; } compobject; @@ -106,6 +107,11 @@ Py_DECREF(self); return NULL; } + self->is_finished = PyInt_FromLong(0); + if (self->is_finished == NULL) { + Py_DECREF(self); + return NULL; + } return self; } @@ -368,6 +374,7 @@ deflateEnd(&self->zst); Py_XDECREF(self->unused_data); Py_XDECREF(self->unconsumed_tail); + Py_XDECREF(self->is_finished); PyObject_Del(self); } @@ -378,6 +385,7 @@ inflateEnd(&self->zst); Py_XDECREF(self->unused_data); Py_XDECREF(self->unconsumed_tail); + Py_XDECREF(self->is_finished); PyObject_Del(self); } @@ -548,6 +556,7 @@ Py_DECREF(RetVal); goto error; } + self->is_finished = PyInt_FromLong(1); /* We will only get Z_BUF_ERROR if the output buffer was full but there wasn't more output when we tried again, so it is not an error condition. @@ -689,10 +698,13 @@ Py_INCREF(self->unused_data); Py_INCREF(self->unconsumed_tail); + Py_INCREF(self->is_finished); Py_XDECREF(retval->unused_data); Py_XDECREF(retval->unconsumed_tail); + Py_XDECREF(retval->is_finished); retval->unused_data = self->unused_data; retval->unconsumed_tail = self->unconsumed_tail; + retval->is_finished = self->is_finished; /* Mark it as being initialized */ retval->is_initialised = 1; @@ -740,10 +752,13 @@ Py_INCREF(self->unused_data); Py_INCREF(self->unconsumed_tail); + Py_INCREF(self->is_finished); Py_XDECREF(retval->unused_data); Py_XDECREF(retval->unconsumed_tail); + Py_XDECREF(retval->is_finished); retval->unused_data = self->unused_data; retval->unconsumed_tail = self->unconsumed_tail; + retval->is_finished = self->is_finished; /* Mark it as being initialized */ retval->is_initialised = 1; @@ -876,6 +891,9 @@ } else if (strcmp(name, "unconsumed_tail") == 0) { Py_INCREF(self->unconsumed_tail); retval = self->unconsumed_tail; + } else if (strcmp(name, "is_finished") == 0) { + Py_INCREF(self->is_finished); + retval = self->is_finished; } else retval = Py_FindMethod(Decomp_methods, (PyObject *)self, name);