Author: Brian Kearns <[email protected]>
Branch: stdlib-2.7.6
Changeset: r69622:35b0897aa1df
Date: 2014-03-02 13:29 -0500
http://bitbucket.org/pypy/pypy/changeset/35b0897aa1df/

Log:    random fixes

diff --git a/pypy/module/pwd/interp_pwd.py b/pypy/module/pwd/interp_pwd.py
--- a/pypy/module/pwd/interp_pwd.py
+++ b/pypy/module/pwd/interp_pwd.py
@@ -69,7 +69,7 @@
     """
     try:
         uid = space.int_w(w_uid)
-        if uid < -1 or uid > most_pos_value_of(uid_t):
+        if uid < -1 or uid > widen(most_pos_value_of(uid_t)):
             raise OperationError(space.w_OverflowError, None)
     except OperationError, e:
         if e.match(space, space.w_OverflowError):
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
@@ -180,7 +180,7 @@
             raise zlib_error(self.space, e.msg)
         return self.space.wrap(result)
 
-    @unwrap_spec(mode=int)
+    @unwrap_spec(mode="c_int")
     def flush(self, mode=rzlib.Z_FINISH):
         """
         flush( [mode] ) -- Return a string containing any remaining compressed
@@ -315,7 +315,7 @@
         data as possible.
         """
         if mode == rzlib.Z_NO_FLUSH:
-            return space.wrap("")
+            return self.space.wrap("")
 
         data = self.unconsumed_tail
         try:
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
@@ -126,6 +126,7 @@
         """
         compressor = self.zlib.compressobj()
         bytes = compressor.compress(self.expanded)
+        raises(OverflowError, compressor.flush, 2**31)
         bytes += compressor.flush()
         assert bytes == self.compressed
 
@@ -136,6 +137,7 @@
         """
         decompressor = self.zlib.decompressobj()
         bytes = decompressor.decompress(self.compressed)
+        raises(OverflowError, decompressor.flush, 2**31)
         bytes += decompressor.flush()
         assert bytes == self.expanded
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to