[pypy-commit] pypy disable_merge_different_int_types: (arigo, bivab): fix some annotation issues and revert some changes

bivab noreply at buildbot.pypy.org
Mon Nov 28 15:55:52 CET 2011


Author: David Schneider <david.schneider at picle.org>
Branch: disable_merge_different_int_types
Changeset: r49911:44192f720e21
Date: 2011-11-28 14:46 +0100
http://bitbucket.org/pypy/pypy/changeset/44192f720e21/

Log:	(arigo, bivab): fix some annotation issues and revert some changes

diff --git a/pypy/module/binascii/interp_crc32.py b/pypy/module/binascii/interp_crc32.py
--- a/pypy/module/binascii/interp_crc32.py
+++ b/pypy/module/binascii/interp_crc32.py
@@ -69,7 +69,7 @@
 
     # in the following loop, we have always 0 <= crc < 2**32
     for c in data:
-        crc = crc_32_tab[(crc & 0xff) ^ r_uint(ord(c))] ^ (crc >> 8)
+        crc = crc_32_tab[(crc & 0xff) ^ ord(c)] ^ (crc >> 8)
 
     crc = ~intmask(rffi.cast(rffi.INT, crc))   # unsigned => 32-bit signed
     return space.wrap(crc)
diff --git a/pypy/rlib/rmd5.py b/pypy/rlib/rmd5.py
--- a/pypy/rlib/rmd5.py
+++ b/pypy/rlib/rmd5.py
@@ -318,7 +318,7 @@
         """
 
         leninBuf = len(inBuf)
-        self.count += r_uint(leninBuf)
+        self.count += leninBuf
         index = len(self.input)
         partLen = 64 - index
         assert partLen > 0
diff --git a/pypy/rlib/rsha.py b/pypy/rlib/rsha.py
--- a/pypy/rlib/rsha.py
+++ b/pypy/rlib/rsha.py
@@ -224,7 +224,7 @@
         """
 
         leninBuf = len(inBuf)
-        self.count += r_uint(leninBuf)
+        self.count += leninBuf
         index = len(self.input)
         partLen = 64 - index
         assert partLen > 0
diff --git a/pypy/rlib/rsocket.py b/pypy/rlib/rsocket.py
--- a/pypy/rlib/rsocket.py
+++ b/pypy/rlib/rsocket.py
@@ -185,9 +185,11 @@
                 0 <= d1 <= 255 and
                 0 <= d2 <= 255 and
                 0 <= d3 <= 255):
-                return makeipv4addr(intmask(htonl(
-                    (intmask(d0 << 24)) | (d1 << 16) | (d2 << 8) | (d3 << 0))),
-                                    result)
+
+                addr = intmask(d0 << 24) | (d1 << 16) | (d2 << 8) | (d3 << 0)
+                addr = rffi.cast(rffi.UINT, addr)
+                addr = htonl(addr)
+                return makeipv4addr(addr, result)
 
     # generic host name to IP conversion
     info = getaddrinfo(name, None, family=family, address_to_fill=result)
@@ -238,7 +240,7 @@
         def get_protocol(self):
             a = self.lock(_c.sockaddr_ll)
             proto = rffi.getintfield(a, 'c_sll_protocol')
-            proto = rffi.cast(rffi.UINT, proto)
+            proto = rffi.cast(rffi.USHORT, proto)
             res = ntohs(proto)
             self.unlock()
             return res
@@ -280,7 +282,7 @@
     def __init__(self, host, port):
         makeipaddr(host, self)
         a = self.lock(_c.sockaddr_in)
-        port = rffi.cast(rffi.UINT, port)
+        port = rffi.cast(rffi.USHORT, port)
         rffi.setintfield(a, 'c_sin_port', htons(port))
         self.unlock()
 


More information about the pypy-commit mailing list