示例#1
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)
示例#2
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)