* Fix thread lock in zlib.Decompress.flush() may go wrong
Getting `.unconsumed_tail` before acquiring the thread lock may mix up decompress state.
(cherry picked from commit
7edb6270a78c695e4c2ae2432797dc18105374fc)
Co-authored-by: Ma Lin <animalize@users.noreply.github.com>
Automerge-Triggered-By: GH:gpshead
--- /dev/null
+Fix thread lock in ``zlib.Decompress.flush()`` method before ``PyObject_GetBuffer``.
return NULL;
}
+ ENTER_ZLIB(self);
+
if (PyObject_GetBuffer(self->unconsumed_tail, &data, PyBUF_SIMPLE) == -1) {
+ LEAVE_ZLIB(self);
return NULL;
}
- ENTER_ZLIB(self);
-
self->zst.next_in = data.buf;
ibuflen = data.len;