Author: Carl Friedrich Bolz <cfb...@gmx.de>
Branch: space-newtext
Changeset: r88074:75357e535417
Date: 2016-11-02 13:10 +0100
http://bitbucket.org/pypy/pypy/changeset/75357e535417/

Log:    zlib

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,7 +30,7 @@
         'decompressobj': 'interp_zlib.Decompress',
         'compress': 'interp_zlib.compress',
         'decompress': 'interp_zlib.decompress',
-        '__version__': 'space.wrap("1.0")',
+        '__version__': 'space.newtext("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
@@ -38,7 +38,7 @@
     # the 2.6 behavior and always return a number in range(-2**31, 2**31).
     checksum = unsigned_to_signed_32bit(checksum)
 
-    return space.wrap(checksum)
+    return space.newint(checksum)
 
 
 @unwrap_spec(string='bufferstr', start='truncatedint_w')
@@ -54,7 +54,7 @@
     # See comments in crc32() for the following line
     checksum = unsigned_to_signed_32bit(checksum)
 
-    return space.wrap(checksum)
+    return space.newint(checksum)
 
 
 class Cache:
@@ -63,7 +63,7 @@
 
 def zlib_error(space, msg):
     w_error = space.fromcache(Cache).w_error
-    return OperationError(w_error, space.wrap(msg))
+    return OperationError(w_error, space.newtext(msg))
 
 
 @unwrap_spec(string='bufferstr', level=int)
@@ -84,7 +84,7 @@
             rzlib.deflateEnd(stream)
     except rzlib.RZlibError as e:
         raise zlib_error(space, e.msg)
-    return space.wrap(result)
+    return space.newbytes(result)
 
 
 @unwrap_spec(string='bufferstr', wbits="c_int", bufsize=int)
@@ -106,7 +106,7 @@
             rzlib.inflateEnd(stream)
     except rzlib.RZlibError as e:
         raise zlib_error(space, e.msg)
-    return space.wrap(result)
+    return space.newbytes(result)
 
 
 class ZLibObject(W_Root):
@@ -177,7 +177,7 @@
                 self.unlock()
         except rzlib.RZlibError as e:
             raise zlib_error(space, e.msg)
-        return space.wrap(result)
+        return space.newbytes(result)
 
     @unwrap_spec(mode="c_int")
     def flush(self, space, mode=rzlib.Z_FINISH):
@@ -206,7 +206,7 @@
                 self.unlock()
         except rzlib.RZlibError as e:
             raise zlib_error(space, e.msg)
-        return space.wrap(result)
+        return space.newbytes(result)
 
 
 @unwrap_spec(level=int, method=int, wbits=int, memLevel=int, strategy=int)
@@ -222,7 +222,7 @@
     stream = space.interp_w(Compress, stream)
     Compress.__init__(stream, space, level,
                       method, wbits, memLevel, strategy)
-    return space.wrap(stream)
+    return stream
 
 
 Compress.typedef = TypeDef(
@@ -303,7 +303,7 @@
 
         string, finished, unused_len = result
         self._save_unconsumed_input(data, finished, unused_len)
-        return space.wrap(string)
+        return space.newbytes(string)
 
     def flush(self, space, w_length=None):
         """
@@ -328,7 +328,7 @@
         else:
             string, finished, unused_len = result
             self._save_unconsumed_input(data, finished, unused_len)
-        return space.wrap(string)
+        return space.newbytes(string)
 
 
 @unwrap_spec(wbits=int)
@@ -339,7 +339,7 @@
     stream = space.allocate_instance(Decompress, w_subtype)
     stream = space.interp_w(Decompress, stream)
     Decompress.__init__(stream, space, wbits)
-    return space.wrap(stream)
+    return stream
 
 
 Decompress.typedef = TypeDef(
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to