Author: Julian Berman <julian...@grayvines.com>
Branch: zlib-copying
Changeset: r95836:7d112d29d885
Date: 2019-02-05 13:59 +0100
http://bitbucket.org/pypy/pypy/changeset/7d112d29d885/

Log:    Acquire the lock around the Decompressor before copying.

        Also handles copying already-flushed decompressobjs.

        Basically the same as what happens in other methods.

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
@@ -318,7 +318,14 @@
 
     def copy(self, space):
         try:
-            copied = rzlib.inflateCopy(self.stream)
+            self.lock()
+            try:
+                if not self.stream:
+                    raise zlib_error(space,
+                                     "decompressor object already flushed")
+                copied = rzlib.inflateCopy(self.stream)
+            finally:
+                self.unlock()
         except rzlib.RZlibError as e:
             raise zlib_error(space, e.msg)
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to