Exemplo n.º 1
0
 def int(self, space):
     if (type(self) is not W_LongObject and
         space.is_overloaded(self, space.w_long, '__int__')):
         return W_Root.int(self, space)
     try:
         return space.newint(self.num.toint())
     except OverflowError:
         return self.descr_long(space)
Exemplo n.º 2
0
 def int(self, space):
     if (type(self) is not W_LongObject
             and space.is_overloaded(self, space.w_long, '__int__')):
         return W_Root.int(self, space)
     try:
         return space.newint(self.num.toint())
     except OverflowError:
         return self.descr_long(space)
Exemplo n.º 3
0
 def int(self, space):
     if (type(self) is not W_FloatObject and
         space.is_overloaded(self, space.w_float, '__int__')):
         return W_Root.int(self, space)
     try:
         value = ovfcheck_float_to_int(self.floatval)
     except OverflowError:
         return space.long(self)
     else:
         return space.newint(value)
Exemplo n.º 4
0
 def int(self, space):
     if type(self) is W_LongObject:
         return self
     if not space.is_overloaded(self, space.w_int, '__int__'):
         return W_LongObject(self.num)
     return W_Root.int(self, space)
Exemplo n.º 5
0
 def int(self, space):
     if type(self) is W_IntObject:
         return self
     if not space.is_overloaded(self, space.w_int, '__int__'):
         return space.newint(self.intval)
     return W_Root.int(self, space)
Exemplo n.º 6
0
 def int(self, space):
     # this is a speed-up only, for space.int(w_float).
     if type(self) is not W_FloatObject and space.is_overloaded(self, space.w_float, "__int__"):
         return W_Root.int(self, space)
     return self.descr_trunc(space)
Exemplo n.º 7
0
 def int(self, space):
     if type(self) is W_LongObject:
         return self
     if not space.is_overloaded(self, space.w_int, '__int__'):
         return W_LongObject(self.num)
     return W_Root.int(self, space)
Exemplo n.º 8
0
 def int(self, space):
     # this is a speed-up only, for space.int(w_float).
     if (type(self) is not W_FloatObject
             and space.is_overloaded(self, space.w_float, '__int__')):
         return W_Root.int(self, space)
     return self.descr_trunc(space)
Exemplo n.º 9
0
 def int(self, space):
     if type(self) is W_IntObject:
         return self
     if not space.is_overloaded(self, space.w_int, '__int__'):
         return space.newint(self.intval)
     return W_Root.int(self, space)