Commits

Christian Tismer committed c1e52fd

a few improvements and cleanups from the merges

Comments (0)

Files changed (6)

pypy/jit/metainterp/history.py

 
     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)

pypy/module/micronumpy/test/test_dtypes.py

 from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
-from pypy.rlib.rarithmetic import is_valid_int
 
 
 class AppTestDtypes(BaseNumpyAppTest):

pypy/rpython/lltypesystem/ll2ctypes.py

             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:

pypy/rpython/lltypesystem/test/test_ll2ctypes.py

                 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):

pypy/translator/c/src/g_prerequisite.h

 /**************************************************************/
 /***  this is included before any code produced by genc.py  ***/
 
+
 #ifdef PYPY_STANDALONE
 #  include "src/commondefs.h"
 #endif

pypy/translator/c/src/mem.h

 #ifndef _WIN64
 #  define pypy_asm_keepalive(v)    __asm { }
 #else
-   /* is there soething cheaper? */
+   /* is there something cheaper? */
 #  define pypy_asm_keepalive(v)    _ReadWriteBarrier();
 #endif