Author: Julian Berman <[email protected]>
Branch:
Changeset: r95901:887c215ee39f
Date: 2019-02-08 07:29 -0500
http://bitbucket.org/pypy/pypy/changeset/887c215ee39f/
Log: Merge zlib-copying-third-time-a-charm.
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -5,6 +5,11 @@
.. this is a revision shortly after release-pypy-7.0.0
.. startrev: 481c69f7d81f
+.. branch: zlib-copying-third-time-a-charm
+
+Make sure zlib decompressobjs have their streams deallocated immediately
+on flush.
+
.. branch: zlib-copying-redux
Fix calling copy on already-flushed compressobjs.
diff --git a/pypy/module/zlib/interp_zlib.py b/pypy/module/zlib/interp_zlib.py
--- a/pypy/module/zlib/interp_zlib.py
+++ b/pypy/module/zlib/interp_zlib.py
@@ -323,12 +323,16 @@
try:
self.lock()
try:
+ if not self.stream:
+ raise oefmt(
+ space.w_ValueError,
+ "Decompressor was already flushed",
+ )
copied = rzlib.inflateCopy(self.stream)
finally:
self.unlock()
except rzlib.RZlibError as e:
raise zlib_error(space, e.msg)
-
return Decompress(
space=space,
stream=copied,
@@ -359,6 +363,9 @@
else:
string, finished, unused_len = result
self._save_unconsumed_input(data, finished, unused_len)
+ if finished:
+ rzlib.inflateEnd(self.stream)
+ self.stream = rzlib.null_stream
return space.newbytes(string)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit