Author: Armin Rigo <ar...@tunes.org> Branch: py3.5 Changeset: r87819:5b8d4614dcc8 Date: 2016-10-15 18:21 +0200 http://bitbucket.org/pypy/pypy/changeset/5b8d4614dcc8/
Log: Support the 64-bit range 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 @@ -265,7 +265,7 @@ else: self.unconsumed_tail = tail - @unwrap_spec(data='bufferstr', max_length="c_int") + @unwrap_spec(data='bufferstr', max_length=int) def decompress(self, space, data, max_length=0): """ decompress(data[, max_length]) -- Return a string containing the @@ -303,7 +303,7 @@ data as possible. """ if w_length is not None: - length = space.c_int_w(w_length) + length = space.int_w(w_length) if length <= 0: raise oefmt(space.w_ValueError, "length must be greater than zero") diff --git a/pypy/module/zlib/test/test_zlib.py b/pypy/module/zlib/test/test_zlib.py --- a/pypy/module/zlib/test/test_zlib.py +++ b/pypy/module/zlib/test/test_zlib.py @@ -129,9 +129,10 @@ zlib.decompressobj should return an object which can be used to decompress bytes. """ + import sys decompressor = self.zlib.decompressobj() bytes = decompressor.decompress(self.compressed) - raises(OverflowError, decompressor.flush, 2**31) + raises(OverflowError, decompressor.flush, sys.maxsize + 1) bytes += decompressor.flush() assert bytes == self.expanded @@ -157,16 +158,17 @@ raises(self.zlib.error, self.zlib.decompress, b'foobar') def test_bad_arguments(self): - import zlib + import zlib, sys + BIG = sys.maxsize + 1 raises(ValueError, zlib.decompressobj().flush, 0) raises(ValueError, zlib.decompressobj().flush, -1) raises(TypeError, zlib.decompressobj().flush, None) - raises(OverflowError, zlib.decompressobj().flush, 2**31) + raises(OverflowError, zlib.decompressobj().flush, BIG) raises(ValueError, zlib.decompressobj().decompress, b'abc', -1) raises(TypeError, zlib.decompressobj().decompress, b'abc', None) - raises(OverflowError, zlib.decompressobj().decompress, b'abc', 2**31) + raises(OverflowError, zlib.decompressobj().decompress, b'abc', BIG) raises(TypeError, self.zlib.decompress, self.compressed, None) - raises(OverflowError, self.zlib.decompress, self.compressed, 2**31) + raises(OverflowError, self.zlib.decompress, self.compressed, BIG) def test_empty_flush(self): import zlib _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit