[pypy-svn] r8499 - pypy/dist/pypy/objspace/std

arigo at codespeak.net arigo at codespeak.net
Sun Jan 23 18:23:46 CET 2005


Author: arigo
Date: Sun Jan 23 18:23:45 2005
New Revision: 8499

Modified:
   pypy/dist/pypy/objspace/std/floatobject.py
   pypy/dist/pypy/objspace/std/longobject.py
Log:
Fixed int(1E10), but by cheating.


Modified: pypy/dist/pypy/objspace/std/floatobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/floatobject.py	(original)
+++ pypy/dist/pypy/objspace/std/floatobject.py	Sun Jan 23 18:23:45 2005
@@ -41,7 +41,10 @@
     return W_FloatObject(space, a)
 
 def int__Float(space, w_value):
-    return space.newint(int(w_value.floatval))
+    value = int(w_value.floatval)
+    if isinstance(value, long):    # XXX cheating
+        return space.long(w_value)
+    return space.newint(value)
 
 def float_w__Float(space, w_float):
     return w_float.floatval

Modified: pypy/dist/pypy/objspace/std/longobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/longobject.py	(original)
+++ pypy/dist/pypy/objspace/std/longobject.py	Sun Jan 23 18:23:45 2005
@@ -46,6 +46,7 @@
                              space.wrap("long int too large to convert to float"))
 
 def long__Float(space, w_floatobj):
+    # XXX cheating
     return W_LongObject(space, long(w_floatobj.floatval))
 
 def int_w__Long(space, w_value):



More information about the Pypy-commit mailing list