[pypy-commit] pypy zlib-copying-redux: Move our check for stream being nullptr to the right place.

Julian Berman pypy.commits at gmail.com
Wed Feb 6 05:03:56 EST 2019


Author: Julian Berman <Julian+Hg at 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()


More information about the pypy-commit mailing list