[pypy-commit] pypy stdlib-2.7.13: Allow 'sys.maxint' as max_length in calls to zlib.decompressobj().decompress()
arigo
pypy.commits at gmail.com
Sun Dec 18 13:19:41 EST 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: stdlib-2.7.13
Changeset: r89159:036509cd4445
Date: 2016-12-18 19:19 +0100
http://bitbucket.org/pypy/pypy/changeset/036509cd4445/
Log: Allow 'sys.maxint' as max_length in calls to
zlib.decompressobj().decompress()
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
@@ -278,7 +278,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
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
@@ -230,6 +230,14 @@
data = d.unconsumed_tail
assert not data
+ def test_max_length_large(self):
+ import sys
+ if sys.version_info < (2, 7, 13):
+ skip("passing a potentially 64-bit int as max_length is not "
+ "supported before 2.7.13")
+ d = self.zlib.decompressobj()
+ assert d.decompress(self.compressed, sys.maxsize) == self.expanded
+
def test_buffer(self):
"""
We should be able to pass buffer objects instead of strings.
More information about the pypy-commit
mailing list