Author: Philip Jenvey <[email protected]>
Branch: remove-intlong-smm
Changeset: r68561:4fa4c6b93a84
Date: 2013-12-27 16:58 -0800
http://bitbucket.org/pypy/pypy/changeset/4fa4c6b93a84/

Log:    lame and mysterious workaround for -Ojit & --objspace-std-
        withsmalllong failing translation

diff --git a/pypy/objspace/std/smalllongobject.py 
b/pypy/objspace/std/smalllongobject.py
--- a/pypy/objspace/std/smalllongobject.py
+++ b/pypy/objspace/std/smalllongobject.py
@@ -14,7 +14,8 @@
 from pypy.objspace.std.intobject import W_AbstractIntObject
 from pypy.objspace.std.longobject import W_AbstractLongObject, W_LongObject
 
-LONGLONG_MIN = r_longlong(-1 << (LONGLONG_BIT - 1))
+# XXX: breaks translation
+#LONGLONG_MIN = r_longlong(-1 << (LONGLONG_BIT - 1))
 
 
 class W_SmallLongObject(W_AbstractLongObject):
@@ -175,7 +176,7 @@
         x = self.longlong
         y = w_other.longlong
         try:
-            if y == -1 and x == LONGLONG_MIN:
+            if y == -1 and x == r_longlong(-1 << (LONGLONG_BIT-1)):
                 raise OverflowError
             z = x // y
         except ZeroDivisionError:
@@ -191,7 +192,7 @@
         x = self.longlong
         y = w_other.longlong
         try:
-            if y == -1 and x == LONGLONG_MIN:
+            if y == -1 and x == r_longlong(-1 << (LONGLONG_BIT-1)):
                 raise OverflowError
             z = x % y
         except ZeroDivisionError:
@@ -204,7 +205,7 @@
         x = self.longlong
         y = w_other.longlong
         try:
-            if y == -1 and x == LONGLONG_MIN:
+            if y == -1 and x == r_longlong(-1 << (LONGLONG_BIT-1)):
                 raise OverflowError
             z = x // y
         except ZeroDivisionError:
@@ -225,7 +226,8 @@
 
         if space.is_none(w_modulus):
             try:
-                return _pow_impl(space, self.longlong, w_exponent)
+                return _pow_impl(space, self.longlong, w_exponent,
+                                 r_longlong(0))
             except ValueError:
                 self = self.descr_float(space)
                 return space.pow(self, w_exponent, space.w_None)
@@ -323,7 +325,7 @@
     def descr_neg(self, space):
         a = self.longlong
         try:
-            if a == LONGLONG_MIN:
+            if a == r_longlong(-1 << (LONGLONG_BIT-1)):
                 raise OverflowError
             x = -a
         except OverflowError:
@@ -413,7 +415,7 @@
     return space.newtuple([div_ovr(space, w_int1, w_int2),
                            mod_ovr(space, w_int1, w_int2)])
 
-def _pow_impl(space, iv, w_int2, iz=r_longlong(0)):
+def _pow_impl(space, iv, w_int2, iz):
     iw = space.int_w(w_int2)
     if iw < 0:
         if iz != 0:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to