[pypy-commit] pypy remove-remaining-smm: Make W_FloatObject a W_Root.

Manuel Jacob noreply at buildbot.pypy.org
Mon Feb 24 04:10:23 CET 2014


Author: Manuel Jacob
Branch: remove-remaining-smm
Changeset: r69333:ea78a007be31
Date: 2014-02-24 03:53 +0100
http://bitbucket.org/pypy/pypy/changeset/ea78a007be31/

Log:	Make W_FloatObject a W_Root.

diff --git a/pypy/objspace/std/floatobject.py b/pypy/objspace/std/floatobject.py
--- a/pypy/objspace/std/floatobject.py
+++ b/pypy/objspace/std/floatobject.py
@@ -2,13 +2,12 @@
 import operator
 import sys
 
+from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.error import OperationError, oefmt
 from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
 from pypy.interpreter.typedef import GetSetProperty
 from pypy.objspace.std import newformat
 from pypy.objspace.std.longobject import W_LongObject
-from pypy.objspace.std.model import registerimplementation, W_Object
-from pypy.objspace.std.register_all import register_all
 from pypy.objspace.std.stdtypedef import StdTypeDef
 from rpython.rlib import rarithmetic, rfloat
 from rpython.rlib.rarithmetic import ovfcheck_float_to_int, intmask, LONG_BIT
@@ -122,7 +121,7 @@
     return _compare
 
 
-class W_FloatObject(W_Object):
+class W_FloatObject(W_Root):
     """This is a implementation of the app-level 'float' type.
     The constructor takes an RPython float as an argument."""
     _immutable_fields_ = ['floatval']
@@ -139,7 +138,7 @@
     def int(self, space):
         if (type(self) is not W_FloatObject and
             space.is_overloaded(self, space.w_float, '__int__')):
-            return W_Object.int(self, space)
+            return W_Root.int(self, space)
         try:
             value = ovfcheck_float_to_int(self.floatval)
         except OverflowError:
@@ -634,8 +633,6 @@
             return space.wrap("0x%sp%s%d" % (s, sign, exp))
 
 
-registerimplementation(W_FloatObject)
-
 W_FloatObject.typedef = StdTypeDef("float",
     __doc__ = '''float(x) -> floating point number
 
@@ -691,7 +688,6 @@
     as_integer_ratio = interp2app(W_FloatObject.descr_as_integer_ratio),
     hex = interp2app(W_FloatObject.descr_hex),
 )
-W_FloatObject.typedef.registermethods(globals())
 
 
 def _char_from_hex(number):
@@ -891,6 +887,3 @@
     if negate_result:
         z = -z
     return z
-
-
-register_all(vars(), globals())


More information about the pypy-commit mailing list