[pypy-commit] pypy default: rmmap is fixed. Signed/unsigned problem, with weird effects in the annotator.

ctismer noreply at buildbot.pypy.org
Wed Dec 7 17:32:03 CET 2011


Author: Christian Tismer <tismer at stackless.com>
Branch: 
Changeset: r50253:588a7a11455b
Date: 2011-12-07 17:06 +0100
http://bitbucket.org/pypy/pypy/changeset/588a7a11455b/

Log:	rmmap is fixed. Signed/unsigned problem, with weird effects in the
	annotator. had a hard time to understand this.

diff --git a/pypy/rlib/rmmap.py b/pypy/rlib/rmmap.py
--- a/pypy/rlib/rmmap.py
+++ b/pypy/rlib/rmmap.py
@@ -420,7 +420,11 @@
                 low, high = _get_file_size(self.file_handle)
                 if not high and low <= sys.maxint:
                     return low
+                # not so sure if the signed/unsigned strictness is a good idea:
+                high = rffi.cast(lltype.Unsigned, high)
+                low = rffi.cast(lltype.Unsigned, low)
                 size = (high << 32) + low
+                size = rffi.cast(lltype.Signed, size)
         elif _POSIX:
             st = os.fstat(self.fd)
             size = st[stat.ST_SIZE]


More information about the pypy-commit mailing list