[pypy-commit] pypy py3.5: expose DEF_BUF_SIZE at app level, only wraps rzlib.OUTPUT_BUFFER_SIZE
plan_rich
pypy.commits at gmail.com
Tue Oct 4 07:40:51 EDT 2016
Author: Richard Plangger <planrichi at gmail.com>
Branch: py3.5
Changeset: r87564:64f6022b0f1d
Date: 2016-10-04 13:38 +0200
http://bitbucket.org/pypy/pypy/changeset/64f6022b0f1d/
Log: expose DEF_BUF_SIZE at app level, only wraps
rzlib.OUTPUT_BUFFER_SIZE
diff --git a/pypy/module/zlib/__init__.py b/pypy/module/zlib/__init__.py
--- a/pypy/module/zlib/__init__.py
+++ b/pypy/module/zlib/__init__.py
@@ -30,6 +30,7 @@
'decompressobj': 'interp_zlib.Decompress',
'compress': 'interp_zlib.compress',
'decompress': 'interp_zlib.decompress',
+ 'DEF_BUF_SIZE': 'interp_zlib.default_buffer_size(space)',
'__version__': 'space.wrap("1.0")',
'error': 'space.fromcache(interp_zlib.Cache).w_error',
}
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
@@ -337,6 +337,8 @@
Decompress.__init__(stream, space, wbits, zdict)
return space.wrap(stream)
+def default_buffer_size(space):
+ return space.wrap(rzlib.OUTPUT_BUFFER_SIZE)
Decompress.typedef = TypeDef(
'Decompress',
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
@@ -29,6 +29,9 @@
py.path.local(pypy.__file__).dirpath().dirpath()
.join('LICENSE').read())
+ def test_def_buf_size(self):
+ assert self.zlib.DEF_BUF_SIZE >= 0
+
def test_error(self):
"""
zlib.error should be an exception class.
More information about the pypy-commit
mailing list