Author: Julian Berman <julian...@grayvines.com>
Branch: zlib-copying-redux
Changeset: r95858:6c3c1a0558e6
Date: 2019-02-06 11:03 +0100
http://bitbucket.org/pypy/pypy/changeset/6c3c1a0558e6/

Log:    Move our check for stream being nullptr to the right place.

        It's compressobj that sets this to nullptr on flush, not
        decompressobj.

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
@@ -175,6 +175,11 @@
         try:
             self.lock()
             try:
+                if not self.stream:
+                    raise oefmt(
+                        space.w_ValueError,
+                        "Compressor was already flushed",
+                    )
                 copied = rzlib.deflateCopy(self.stream)
             finally:
                 self.unlock()
@@ -318,9 +323,6 @@
         try:
             self.lock()
             try:
-                if not self.stream:
-                    raise zlib_error(space,
-                                     "decompressor object already flushed")
                 copied = rzlib.inflateCopy(self.stream)
             finally:
                 self.unlock()
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to