Author: Philip Jenvey <pjen...@underboss.org>
Branch: 
Changeset: r75176:11240a20d1d2
Date: 2014-12-30 18:52 -0800
http://bitbucket.org/pypy/pypy/changeset/11240a20d1d2/

Log:    add zlibVersion (for py3.3)

diff --git a/rpython/rlib/rzlib.py b/rpython/rlib/rzlib.py
--- a/rpython/rlib/rzlib.py
+++ b/rpython/rlib/rzlib.py
@@ -167,6 +167,7 @@
 
 _deflateSetDictionary = zlib_external('deflateSetDictionary', [z_stream_p, 
Bytefp, uInt], rffi.INT)
 _inflateSetDictionary = zlib_external('inflateSetDictionary', [z_stream_p, 
Bytefp, uInt], rffi.INT)
+_zlibVersion = zlib_external('zlibVersion', [], rffi.CCHARP)
 
 # ____________________________________________________________
 
@@ -208,6 +209,10 @@
         checksum = _adler32(start, rffi.cast(Bytefp, bytes), len(string))
     return checksum
 
+def zlibVersion():
+    """Return the runtime version of zlib library"""
+    return rffi.charp2str(_zlibVersion())
+
 # ____________________________________________________________
 
 class RZlibError(Exception):
diff --git a/rpython/rlib/test/test_rzlib.py b/rpython/rlib/test/test_rzlib.py
--- a/rpython/rlib/test/test_rzlib.py
+++ b/rpython/rlib/test/test_rzlib.py
@@ -269,3 +269,7 @@
         assert unused > 0
         buf = buf[-unused:]
     rzlib.deflateEnd(stream)
+
+def test_zlibVersion():
+    runtime_version = rzlib.zlibVersion()
+    assert runtime_version[0] == rzlib.ZLIB_VERSION[0]
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to