def unique_id(self, space): if self.user_overridden_class: return W_Object.unique_id(self, space) from pypy.objspace.std.model import IDTAG_INT as tag b = space.bigint_w(self) b = b.lshift(3).or_(rbigint.fromint(tag)) return space.newlong_from_rbigint(b)
def int(self, space): if (type(self) is not W_IntObject and space.is_overloaded(self, space.w_int, '__int__')): return W_Object.int(self, space) if space.is_w(space.type(self), space.w_int): return self a = self.intval return wrapint(space, a)
def unique_id(self, space): if self.user_overridden_class: return W_Object.unique_id(self, space) from pypy.rlib.longlong2float import float2longlong from pypy.objspace.std.model import IDTAG_FLOAT as tag val = float2longlong(space.float_w(self)) b = rbigint.fromrarith_int(val) b = b.lshift(3).or_(rbigint.fromint(tag)) return space.newlong_from_rbigint(b)
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) try: value = ovfcheck_float_to_int(self.floatval) except OverflowError: return space.long(self) else: return space.newint(value)
def unique_id(self, space): if self.user_overridden_class: return W_Object.unique_id(self, space) from pypy.rlib.longlong2float import float2longlong from pypy.objspace.std.model import IDTAG_COMPLEX as tag real = space.float_w(space.getattr(self, space.wrap("real"))) imag = space.float_w(space.getattr(self, space.wrap("imag"))) real_b = rbigint.fromrarith_int(float2longlong(real)) imag_b = rbigint.fromrarith_int(float2longlong(imag)) val = real_b.lshift(64).or_(imag_b).lshift(3).or_(rbigint.fromint(tag)) return space.newlong_from_rbigint(val)
def getdict(w_self, space): try: d = w_self.val.__dict__ except AttributeError: return W_Object.getdict(w_self, space) return space.wrap(d)
def unique_id(self, space): if self.user_overridden_class: return W_Object.unique_id(self, space) return space.wrap(compute_unique_id(space.str_w(self)))