Example #1
0
 def compute_result_annotation(self, s_arg):
     from rpython.annotator.model import SomeInteger
     if isinstance(s_arg, SomeInteger) and s_arg.unsigned:
         raise UnexpectedRUInt("check_nonneg() arg is a %s" %
                               (s_arg.knowntype, ))
     s_nonneg = SomeInteger(nonneg=True)
     if not s_nonneg.contains(s_arg):
         raise IntegerCanBeNegative
     return s_arg
Example #2
0
 def compute_result_annotation(self, s_arg):
     from rpython.annotator.model import SomeInteger
     if isinstance(s_arg, SomeInteger) and s_arg.unsigned:
         raise UnexpectedRUInt("check_nonneg() arg is a %s" % (
             s_arg.knowntype,))
     s_nonneg = SomeInteger(nonneg=True)
     if not s_nonneg.contains(s_arg):
         raise IntegerCanBeNegative
     return s_arg