Author: Hakan Ardo <[email protected]>
Branch: jit-usable_retrace_3
Changeset: r60245:8e58b8431a3a
Date: 2013-01-20 19:56 +0100
http://bitbucket.org/pypy/pypy/changeset/8e58b8431a3a/
Log: use overflow check instead to get a well defined (but silly)
behaviour
diff --git a/pypy/jit/metainterp/test/test_random_loops.py
b/pypy/jit/metainterp/test/test_random_loops.py
--- a/pypy/jit/metainterp/test/test_random_loops.py
+++ b/pypy/jit/metainterp/test/test_random_loops.py
@@ -1,7 +1,7 @@
from pypy.jit.metainterp.test.support import LLJitMixin
from pypy.rlib.jit import JitDriver
from random import choice, randrange
-from pypy.rlib.rarithmetic import intmask
+from pypy.rlib.rarithmetic import ovfcheck
import re
class IntBox(object):
@@ -12,10 +12,16 @@
return self.val
def add(self, other):
- return IntBox(intmask(self.value() + other.value()))
+ try:
+ return IntBox(ovfcheck(self.value() + other.value()))
+ except OverflowError:
+ return IntBox(42)
def sub(self, other):
- return IntBox(intmask(self.value() - other.value()))
+ try:
+ return IntBox(ovfcheck(self.value() - other.value()))
+ except OverflowError:
+ return IntBox(-42)
def gt(self, other):
return IntBox(self.value() > other.value())
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit