[pypy-svn] rev 561 - pypy/trunk/src/pypy/objspace/std

tismer at codespeak.net tismer at codespeak.net
Tue May 27 15:40:23 CEST 2003


Author: tismer
Date: Tue May 27 15:40:22 2003
New Revision: 561

Modified:
   pypy/trunk/src/pypy/objspace/std/restricted_int.py
Log:
made restrincted ints work with sequence multiply

Modified: pypy/trunk/src/pypy/objspace/std/restricted_int.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/restricted_int.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/restricted_int.py	Tue May 27 15:40:22 2003
@@ -38,7 +38,10 @@
     def __mul__(self, other):
         x = int(self)
         y = int(other)
-        return r_int(x * y)
+        res = x * y
+        if not isinstance(res, int, long)):
+            res = r_int(res)
+        return res
     __rmul__ = __mul__
 
     def __div__(self, other):
@@ -175,7 +178,10 @@
     def __mul__(self, other):
         x = long(self)
         y = long(other)
-        return r_uint(x * y)
+        res = x * y
+        if not isinstance(res, int, long)):
+            res = r_uint(res)
+        return res
     __rmul__ = __mul__
 
     def __div__(self, other):


More information about the Pypy-commit mailing list