[pypy-svn] r15298 - pypy/dist/pypy/objspace/std
arigo at codespeak.net
arigo at codespeak.net
Thu Jul 28 22:30:29 CEST 2005
Author: arigo
Date: Thu Jul 28 22:30:26 2005
New Revision: 15298
Modified:
pypy/dist/pypy/objspace/std/floatobject.py
Log:
Do the correct thing in int__Float() with respect to longs.
Modified: pypy/dist/pypy/objspace/std/floatobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/floatobject.py (original)
+++ pypy/dist/pypy/objspace/std/floatobject.py Thu Jul 28 22:30:26 2005
@@ -49,10 +49,12 @@
return W_FloatObject(space, a)
def int__Float(space, w_value):
- value = int(w_value.floatval)
- if isinstance(value, long): # XXX cheating
+ try:
+ value = ovfcheck_float_to_int(w_value.floatval)
+ except OverflowError:
return space.long(w_value)
- return space.newint(value)
+ else:
+ return space.newint(value)
def float_w__Float(space, w_float):
return w_float.floatval
More information about the Pypy-commit
mailing list