[pypy-svn] r8565 - pypy/dist/pypy/objspace/std
arigo at codespeak.net
arigo at codespeak.net
Tue Jan 25 15:31:45 CET 2005
Author: arigo
Date: Tue Jan 25 15:31:45 2005
New Revision: 8565
Modified:
pypy/dist/pypy/objspace/std/floatobject.py
pypy/dist/pypy/objspace/std/intobject.py
pypy/dist/pypy/objspace/std/longobject.py
Log:
Populate the truediv multimethod.
Modified: pypy/dist/pypy/objspace/std/floatobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/floatobject.py (original)
+++ pypy/dist/pypy/objspace/std/floatobject.py Tue Jan 25 15:31:45 2005
@@ -175,6 +175,8 @@
# no overflow
return W_FloatObject(space, z)
+truediv__Float_Float = div__Float_Float
+
def floordiv__Float_Float(space, w_float1, w_float2):
x = w_float1.floatval
y = w_float2.floatval
Modified: pypy/dist/pypy/objspace/std/intobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/intobject.py (original)
+++ pypy/dist/pypy/objspace/std/intobject.py Tue Jan 25 15:31:45 2005
@@ -211,14 +211,16 @@
m = x % y
return space.wrap((z,m))
+old_style_div = 1 / 2 == 1 // 2
def div__Int_Int(space, w_int1, w_int2):
# Select the proper div
- if 1 / 2 == 1 // 2:
+ if old_style_div:
return _floordiv(space, w_int1, w_int2)
else:
return _truediv(space, w_int1, w_int2)
floordiv__Int_Int = _floordiv
+truediv__Int_Int = _truediv
# helper for pow()
def _impl_int_int_pow(space, iv, iw, iz=None):
Modified: pypy/dist/pypy/objspace/std/longobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/longobject.py (original)
+++ pypy/dist/pypy/objspace/std/longobject.py Tue Jan 25 15:31:45 2005
@@ -107,6 +107,8 @@
z = x / y
return W_LongObject(space, z)
+truediv__Long_Long = div__Long_Long
+
def floordiv__Long_Long(space, w_long1, w_long2):
x = w_long1.longval
y = w_long2.longval
More information about the Pypy-commit
mailing list