Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r74221:1b9629032983
Date: 2014-10-25 16:23 +0200
http://bitbucket.org/pypy/pypy/changeset/1b9629032983/

Log:    fix

diff --git a/rpython/rlib/rzlib.py b/rpython/rlib/rzlib.py
--- a/rpython/rlib/rzlib.py
+++ b/rpython/rlib/rzlib.py
@@ -185,16 +185,14 @@
 ADLER32_DEFAULT_START = 1
 
 def deflateSetDictionary(stream, string):
-    bytes = rffi.get_nonmovingbuffer(string)
-    err = _deflateSetDictionary(stream, rffi.cast(Bytefp, bytes), len(string))
-    rffi.free_nonmovingbuffer(string, bytes)
+    with rffi.scoped_nonmovingbuffer(string) as buf:
+        err = _deflateSetDictionary(stream, rffi.cast(Bytefp, buf), 
len(string))
     if err == Z_STREAM_ERROR:
         raise RZlibError("Parameter is invalid or the stream state is 
inconsistent")
 
 def inflateSetDictionary(stream, string):
-    bytes = rffi.get_nonmovingbuffer(string)
-    err = _inflateSetDictionary(stream, rffi.cast(Bytefp, bytes), len(string))
-    rffi.free_nonmovingbuffer(string, bytes)
+    with rffi.scoped_nonmovingbuffer(string) as buf:
+        err = _inflateSetDictionary(stream, rffi.cast(Bytefp, buf), 
len(string))
     if err == Z_STREAM_ERROR:
         raise RZlibError("Parameter is invalid or the stream state is 
inconsistent")
     elif err == Z_DATA_ERROR:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to