Author: Alex Gaynor <alex.gay...@gmail.com> Branch: Changeset: r62693:9bdbaa4b41e9 Date: 2013-03-23 10:29 -0700 http://bitbucket.org/pypy/pypy/changeset/9bdbaa4b41e9/
Log: (alex, fijal): removed float_w multimethod diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -211,6 +211,10 @@ raise OperationError(space.w_TypeError, typed_unwrap_error_msg(space, "integer", self)) + def float_w(self, space): + raise OperationError(space.w_TypeError, + typed_unwrap_error_msg(space, "float", self)) + def uint_w(self, space): raise OperationError(space.w_TypeError, typed_unwrap_error_msg(space, "integer", self)) @@ -1308,6 +1312,9 @@ def bigint_w(self, w_obj): return w_obj.bigint_w(self) + def float_w(self, w_obj): + return w_obj.float_w(self) + def realstr_w(self, w_obj): # Like str_w, but only works if w_obj is really of type 'str'. if not self.is_true(self.isinstance(w_obj, self.w_str)): @@ -1670,4 +1677,4 @@ 'newslice', 'call_args', 'marshal_w', - ] +] diff --git a/pypy/objspace/std/default.py b/pypy/objspace/std/default.py --- a/pypy/objspace/std/default.py +++ b/pypy/objspace/std/default.py @@ -1,6 +1,5 @@ """Default implementation for some operation.""" -from pypy.interpreter.error import OperationError, typed_unwrap_error_msg from pypy.objspace.std.register_all import register_all @@ -9,8 +8,4 @@ def init__ANY(space, w_obj, __args__): pass -def float_w__ANY(space,w_obj): - raise OperationError(space.w_TypeError, - typed_unwrap_error_msg(space, "float", w_obj)) - register_all(vars()) 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 @@ -55,6 +55,9 @@ def unwrap(w_self, space): return w_self.floatval + def float_w(self, space): + return self.floatval + def __repr__(self): return "<W_FloatObject(%f)>" % self.floatval @@ -114,9 +117,6 @@ else: return space.newint(value) -def float_w__Float(space, w_float): - return w_float.floatval - def _char_from_hex(number): return "0123456789abcdef"[number] diff --git a/pypy/objspace/std/intobject.py b/pypy/objspace/std/intobject.py --- a/pypy/objspace/std/intobject.py +++ b/pypy/objspace/std/intobject.py @@ -64,6 +64,9 @@ def bigint_w(w_self, space): return rbigint.fromint(w_self.intval) + def float_w(self, space): + return float(self.intval) + registerimplementation(W_IntObject) # NB: This code is shared by smallintobject.py, and thus no other Int diff --git a/pypy/objspace/std/longobject.py b/pypy/objspace/std/longobject.py --- a/pypy/objspace/std/longobject.py +++ b/pypy/objspace/std/longobject.py @@ -84,6 +84,9 @@ def bigint_w(w_self, space): return w_self.num + def float_w(self, space): + return self.num.tofloat() + def __repr__(self): return '<W_LongObject(%d)>' % self.num.tolong() diff --git a/pypy/objspace/std/model.py b/pypy/objspace/std/model.py --- a/pypy/objspace/std/model.py +++ b/pypy/objspace/std/model.py @@ -436,7 +436,6 @@ init = StdObjSpaceMultiMethod('__init__', 1, general__args__=True) getnewargs = StdObjSpaceMultiMethod('__getnewargs__', 1) # special visible multimethods - float_w = StdObjSpaceMultiMethod('float_w', 1, []) # returns an unwrapped float # NOTE: when adding more sometype_w() methods, you need to write a # stub in default.py to raise a space.w_TypeError marshal_w = StdObjSpaceMultiMethod('marshal_w', 1, [], extra_args=['marshaller']) @@ -449,4 +448,3 @@ del mm pow.extras['defaults'] = (None,) - diff --git a/pypy/objspace/std/smalllongobject.py b/pypy/objspace/std/smalllongobject.py --- a/pypy/objspace/std/smalllongobject.py +++ b/pypy/objspace/std/smalllongobject.py @@ -66,6 +66,10 @@ def bigint_w(w_self, space): return w_self.asbigint() + def float_w(self, space): + return float(self.longlong) + + registerimplementation(W_SmallLongObject) # ____________________________________________________________ _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit