[pypy-commit] pypy win64-stage1: a few improvements and cleanups from the merges

ctismer noreply at buildbot.pypy.org
Wed Mar 14 06:53:02 CET 2012


Author: Christian Tismer <tismer at stackless.com>
Branch: win64-stage1
Changeset: r53531:c1e52fdbdb16
Date: 2012-03-13 22:50 -0700
http://bitbucket.org/pypy/pypy/changeset/c1e52fdbdb16/

Log:	a few improvements and cleanups from the merges

diff --git a/pypy/jit/metainterp/history.py b/pypy/jit/metainterp/history.py
--- a/pypy/jit/metainterp/history.py
+++ b/pypy/jit/metainterp/history.py
@@ -449,7 +449,7 @@
 
     def __init__(self, value=0):
         if not we_are_translated():
-            if isinstance(value, (int, long)):
+            if is_valid_int(value):
                 value = int(value)    # bool -> int
             else:
                 assert isinstance(value, Symbolic)
diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -1,5 +1,4 @@
 from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
-from pypy.rlib.rarithmetic import is_valid_int
 
 
 class AppTestDtypes(BaseNumpyAppTest):
diff --git a/pypy/rpython/lltypesystem/ll2ctypes.py b/pypy/rpython/lltypesystem/ll2ctypes.py
--- a/pypy/rpython/lltypesystem/ll2ctypes.py
+++ b/pypy/rpython/lltypesystem/ll2ctypes.py
@@ -238,15 +238,17 @@
             if cls._ptrtype:
                 return cls._ptrtype
             # ctypes can raise OverflowError on 64-bit builds
-            for n in [maxint, 2**31]:
+            # on windows it raises AttributeError even for 2**31 (_length_ missing)
+            if _MS_WINDOWS:
+                other_limit = 2**31-1
+            else:
+                other_limit = 2**31
+            for n in [maxint, other_limit]:
                 cls.MAX_SIZE = n / ctypes.sizeof(ctypes_item)
                 try:
                     cls._ptrtype = ctypes.POINTER(cls.MAX_SIZE * ctypes_item)
-                except OverflowError, e:
+                except (OverflowError, AttributeError), e:
                     pass
-                except AttributeError, e:
-                    pass # XXX win64 failure and segfault, afterwards:
-                    # AttributeError: class must define a '_length_' attribute, which must be a positive integer
                 else:
                     break
             else:
diff --git a/pypy/rpython/lltypesystem/test/test_ll2ctypes.py b/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
--- a/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
+++ b/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
@@ -1075,7 +1075,7 @@
                 return sys.maxint/2 * 3
 
         res = cast_adr_to_int(someaddr())
-        assert is_emulated_long(res)
+        assert is_valid_int(res)
         assert res == -sys.maxint/2 - 3
 
     def test_cast_gcref_back_and_forth(self):
diff --git a/pypy/translator/c/src/g_prerequisite.h b/pypy/translator/c/src/g_prerequisite.h
--- a/pypy/translator/c/src/g_prerequisite.h
+++ b/pypy/translator/c/src/g_prerequisite.h
@@ -2,6 +2,7 @@
 /**************************************************************/
 /***  this is included before any code produced by genc.py  ***/
 
+
 #ifdef PYPY_STANDALONE
 #  include "src/commondefs.h"
 #endif
diff --git a/pypy/translator/c/src/mem.h b/pypy/translator/c/src/mem.h
--- a/pypy/translator/c/src/mem.h
+++ b/pypy/translator/c/src/mem.h
@@ -76,7 +76,7 @@
 #ifndef _WIN64
 #  define pypy_asm_keepalive(v)    __asm { }
 #else
-   /* is there soething cheaper? */
+   /* is there something cheaper? */
 #  define pypy_asm_keepalive(v)    _ReadWriteBarrier();
 #endif
 


More information about the pypy-commit mailing list