Commits

Armin Rigo committed bb90c26 Merge

hg merge default

Comments (0)

Files changed (8)

pypy/jit/metainterp/blackhole.py

         elif opnum == rop.GUARD_NO_OVERFLOW:
             # Produced by int_xxx_ovf().  The pc is just after the opcode.
             # We get here because it did not used to overflow, but now it does.
-            return get_llexception(self.cpu, OverflowError())
+            if not dont_change_position:
+                return get_llexception(self.cpu, OverflowError())
         #
         elif opnum == rop.GUARD_OVERFLOW:
             # Produced by int_xxx_ovf().  The pc is just after the opcode.

pypy/jit/metainterp/pyjitpl.py

             pass # XXX we want to do something special in resume descr,
                  # but not now
         elif opnum == rop.GUARD_NO_OVERFLOW:   # an overflow now detected
-            self.execute_raised(OverflowError(), constant=True)
-            try:
-                self.finishframe_exception()
-            except ChangeFrame:
-                pass
+            if not dont_change_position:
+                self.execute_raised(OverflowError(), constant=True)
+                try:
+                    self.finishframe_exception()
+                except ChangeFrame:
+                    pass
         elif opnum == rop.GUARD_OVERFLOW:      # no longer overflowing
             self.clear_exception()
         else:

pypy/jit/metainterp/test/test_ajit.py

                 if y&4 == 0:
                     x1, x2 = x2, x1
             return res
+        res = self.meta_interp(f, [6, sys.maxint, 32, 48])
+        assert res == f(6, sys.maxint, 32, 48)
         res = self.meta_interp(f, [sys.maxint, 6, 32, 48])
         assert res == f(sys.maxint, 6, 32, 48)
-        res = self.meta_interp(f, [6, sys.maxint, 32, 48])
-        assert res == f(6, sys.maxint, 32, 48)
         
 
     def test_loop_invariant_intbox(self):

pypy/jit/metainterp/test/test_compile.py

     ts = typesystem.llhelper
     def __init__(self):
         self.seen = []
-    def compile_loop(self, inputargs, operations, token, name=''):
+    def compile_loop(self, inputargs, operations, token, log=True, name=''):
         self.seen.append((inputargs, operations, token))
 
 class FakeLogger(object):

pypy/jit/metainterp/warmspot.py

     if not kwds.get('translate_support_code', False):
         warmrunnerdesc.metainterp_sd.profiler.finish()
         warmrunnerdesc.metainterp_sd.cpu.finish_once()
-    print '~~~ return value:', res
+    print '~~~ return value:', repr(res)
     while repeat > 1:
         print '~' * 79
         res1 = interp.eval_graph(graph, args)

pypy/module/_md5/test/test_md5.py

         assert self.md5.digest_size == 16
         #assert self.md5.digestsize == 16        -- not on CPython
         assert self.md5.md5().digest_size == 16
-        if sys.version >= (2, 5):
+        if sys.version_info >= (2, 5):
             assert self.md5.blocksize == 1
             assert self.md5.md5().digestsize == 16
 

pypy/module/array/interp_array.py

 from pypy.objspace.std.register_all import register_all
 from pypy.rlib.rarithmetic import ovfcheck
 from pypy.rlib.unroll import unrolling_iterable
+from pypy.rlib.objectmodel import specialize
 from pypy.rpython.lltypesystem import lltype, rffi
 
 
 
 
 def make_array(mytype):
+    W_ArrayBase = globals()['W_ArrayBase']
+
     class W_Array(W_ArrayBase):
         itemsize = mytype.bytes
         typecode = mytype.typecode
 
         @staticmethod
         def register(typeorder):
-            typeorder[W_Array] = []
+            typeorder[W_Array] = [(W_ArrayBase, None)]
 
         def __init__(self, space):
             self.space = space
             raise OperationError(space.w_ValueError, space.wrap(msg))
 
     # Compare methods
+    @specialize.arg(3)
     def _cmp_impl(space, self, other, space_fn):
-        if isinstance(other, W_ArrayBase):
-            w_lst1 = array_tolist__Array(space, self)
-            w_lst2 = space.call_method(other, 'tolist')
-            return space_fn(w_lst1, w_lst2)
-        else:
-            return space.w_NotImplemented
+        w_lst1 = array_tolist__Array(space, self)
+        w_lst2 = space.call_method(other, 'tolist')
+        return space_fn(w_lst1, w_lst2)
 
-    def eq__Array_ANY(space, self, other):
+    def eq__Array_ArrayBase(space, self, other):
         return _cmp_impl(space, self, other, space.eq)
 
-    def ne__Array_ANY(space, self, other):
+    def ne__Array_ArrayBase(space, self, other):
         return _cmp_impl(space, self, other, space.ne)
 
-    def lt__Array_ANY(space, self, other):
+    def lt__Array_ArrayBase(space, self, other):
         return _cmp_impl(space, self, other, space.lt)
 
-    def le__Array_ANY(space, self, other):
+    def le__Array_ArrayBase(space, self, other):
         return _cmp_impl(space, self, other, space.le)
 
-    def gt__Array_ANY(space, self, other):
+    def gt__Array_ArrayBase(space, self, other):
         return _cmp_impl(space, self, other, space.gt)
 
-    def ge__Array_ANY(space, self, other):
+    def ge__Array_ArrayBase(space, self, other):
         return _cmp_impl(space, self, other, space.ge)
 
     # Misc methods

pypy/module/array/test/test_array.py

         cls.maxint = sys.maxint
 
 class AppTestArray(BaseArrayTests):
+    OPTIONS = {}
+
     def setup_class(cls):
-        cls.space = gettestobjspace(usemodules=('array', 'struct', '_rawffi'))
+        cls.space = gettestobjspace(usemodules=('array', 'struct', '_rawffi'),
+                                    **cls.OPTIONS)
         cls.w_array = cls.space.appexec([], """():
             import array
             return array.array
         a = self.array('b', range(4))
         a[::-1] = a
         assert a == self.array('b', [3, 2, 1, 0])
+
+
+class AppTestArrayBuiltinShortcut(AppTestArray):
+    OPTIONS = {'objspace.std.builtinshortcut': True}