(original) (raw)
--- Python-2.6.1.orig/Modules/zlibmodule.c 2008-06-08 23:58:54.000000000 -0500 +++ Python-2.6.1/Modules/zlibmodule.c 2009-08-21 11:28:20.445594573 -0500 @@ -66,6 +66,7 @@ z_stream zst; PyObject *unused_data; PyObject *unconsumed_tail; + int is_finished; int is_initialised; } compobject; @@ -96,6 +97,7 @@ if (self == NULL) return NULL; self->is_initialised = 0; + self->is_finished = 0; self->unused_data = PyString_FromString(""); if (self->unused_data == NULL) { Py_DECREF(self); @@ -548,6 +550,7 @@ Py_DECREF(RetVal); goto error; } + self->is_finished = 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. @@ -693,6 +696,7 @@ Py_XDECREF(retval->unconsumed_tail); 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; @@ -744,6 +748,7 @@ Py_XDECREF(retval->unconsumed_tail); 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 +881,8 @@ } else if (strcmp(name, "unconsumed_tail") == 0) { Py_INCREF(self->unconsumed_tail); retval = self->unconsumed_tail; + } else if (strcmp(name, "is_finished") == 0) { + retval = PyInt_FromLong(self->is_finished); } else retval = Py_FindMethod(Decomp_methods, (PyObject *)self, name);