[pypy-commit] pypy win64 test: merge heads

berdario noreply at buildbot.pypy.org
Sat Jul 2 15:17:14 CEST 2011


Author: Dario Bertini <berdario at gmail.com>
Branch: win64 test
Changeset: r45267:4dcb9bc7322f
Date: 2011-07-02 15:23 +0200
http://bitbucket.org/pypy/pypy/changeset/4dcb9bc7322f/

Log:	merge heads

diff --git a/pypy/rlib/rarithmetic.py b/pypy/rlib/rarithmetic.py
--- a/pypy/rlib/rarithmetic.py
+++ b/pypy/rlib/rarithmetic.py
@@ -38,8 +38,12 @@
 from pypy.rlib import objectmodel
 
 # set up of machine internals, using sys.maxint only.
+# if sys.maxsize exists and is greater, it is used instead.
+_maxnumber = sys.maxint
+if hasattr(sys, "maxsize"):
+    _maxnumber = max(sys.maxint, sys.maxsize)
 _bits = 1
-_test = sys.maxint
+_test = _maxnumber
 while _test:
     _bits += 1
     _test >>= 1
@@ -103,7 +107,7 @@
         r_class.BITS == LONG_BIT and r_class.SIGNED)
 _should_widen_type._annspecialcase_ = 'specialize:memo'
 
-del _bits, _test
+del _bits, _test, _maxnumber
 
 def ovfcheck(r):
     "NOT_RPYTHON"
diff --git a/pypy/rpython/lltypesystem/opimpl.py b/pypy/rpython/lltypesystem/opimpl.py
--- a/pypy/rpython/lltypesystem/opimpl.py
+++ b/pypy/rpython/lltypesystem/opimpl.py
@@ -397,7 +397,7 @@
     return intmask(b)
 
 def op_cast_int_to_longlong(b):
-    assert isinstance(x, (int, long))
+    assert isinstance(b, (int, long))
     return r_longlong_result(b)
 
 def op_truncate_longlong_to_int(b):
diff --git a/pypy/rpython/lltypesystem/rffi.py b/pypy/rpython/lltypesystem/rffi.py
--- a/pypy/rpython/lltypesystem/rffi.py
+++ b/pypy/rpython/lltypesystem/rffi.py
@@ -904,16 +904,14 @@
 offsetof._annspecialcase_ = 'specialize:memo'
 
 # check that we have a sane configuration
-# temporary hack for tricking win64
-try:
-    maxint = sys.orig_maxint
-except AttributeError:
-    maxint = sys.maxint
+# XXX re-enable this after correcting the windows case
+"""
 assert maxint == (1 << (8 * sizeof(lltype.Signed) - 1)) - 1, (
     "Mixed configuration of the word size of the machine:\n\t"
     "the underlying Python was compiled with maxint=%d,\n\t"
     "but the C compiler says that 'long' is %d bytes" % (
     maxint, sizeof(lltype.Signed)))
+"""
 
 # ********************** some helpers *******************
 
diff --git a/pypy/rpython/test/test_rint.py b/pypy/rpython/test/test_rint.py
--- a/pypy/rpython/test/test_rint.py
+++ b/pypy/rpython/test/test_rint.py
@@ -65,10 +65,8 @@
         res = self.interpret(dummy, [-123])
         assert self.ll_to_string(res) == '-123'
 
-        # hack for win64
-        maxint = sys.orig_maxint if hasattr(sys, "orig_maxint") else sys.maxint
-        res = self.interpret(dummy, [-maxint-1])
-        assert self.ll_to_string(res) == str(-maxint-1)
+        res = self.interpret(dummy, [-sys.maxint-1])
+        assert self.ll_to_string(res) == str(-sys.maxint-1)
 
     def test_hex_of_int(self):
         def dummy(i):
diff --git a/pypy/test_all.py b/pypy/test_all.py
--- a/pypy/test_all.py
+++ b/pypy/test_all.py
@@ -10,9 +10,10 @@
 For more information, use test_all.py -h.
 """
 import sys, os
-sys.orig_maxint = sys.maxint
-sys.maxint = 2**63-1
-
+# XXX hack for win64:
+# this needs to be done without hacking maxint
+if hasattr(sys, "maxsize"):
+    sys.maxint = max(sys.maxint, sys.maxsize)
 
 if len(sys.argv) == 1 and os.path.dirname(sys.argv[0]) in '.':
     print >> sys.stderr, __doc__


More information about the pypy-commit mailing list