[pypy-svn] r34390 - in pypy/dist/pypy/objspace/std: . test

arigo at codespeak.net arigo at codespeak.net
Wed Nov 8 19:27:12 CET 2006


Author: arigo
Date: Wed Nov  8 19:27:11 2006
New Revision: 34390

Modified:
   pypy/dist/pypy/objspace/std/longobject.py
   pypy/dist/pypy/objspace/std/test/test_longobject.py
Log:
An exception case that got lost during the rlong refactoring.


Modified: pypy/dist/pypy/objspace/std/longobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/longobject.py	(original)
+++ pypy/dist/pypy/objspace/std/longobject.py	Wed Nov  8 19:27:11 2006
@@ -139,6 +139,9 @@
     except ZeroDivisionError:
         raise OperationError(space.w_ZeroDivisionError,
                              space.wrap("long division or modulo by zero"))
+    except OverflowError:
+        raise OperationError(space.w_OverflowError,
+                             space.wrap("long/long too large for a float"))
 
 def floordiv__Long_Long(space, w_long1, w_long2):
     try:

Modified: pypy/dist/pypy/objspace/std/test/test_longobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_longobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_longobject.py	Wed Nov  8 19:27:11 2006
@@ -123,4 +123,9 @@
         assert long(n) == n
         assert str(long(n)) == str(n)
 
-
+    def test_huge_longs(self):
+        import operator
+        huge = 1L << 40000L
+        raises(OverflowError, float, huge)
+        raises(OverflowError, operator.truediv, huge, 3)
+        raises(OverflowError, operator.truediv, huge, 3L)



More information about the Pypy-commit mailing list