예제 #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)