示例#1
0
 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)
示例#2
0
文件: intobject.py 项目: charred/pypy
 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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 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)
示例#6
0
文件: fake.py 项目: gorakhargosh/pypy
 def getdict(w_self, space):
     try:
         d = w_self.val.__dict__
     except AttributeError:
         return W_Object.getdict(w_self, space)
     return space.wrap(d)
示例#7
0
 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)))
示例#8
0
文件: fake.py 项目: njues/Sypy
 def getdict(w_self, space):
     try:
         d = w_self.val.__dict__
     except AttributeError:
         return W_Object.getdict(w_self, space)
     return space.wrap(d)