Commits

Maciej Fijalkowski  committed 0e57c3e Draft

enforce those things to be unsigned

  • Participants
  • Parent commits 8752e56

Comments (0)

Files changed (2)

File rpython/rlib/objectmodel.py

             else:
                 return type(arg)
         def typecheck(*args):
-            from rpython.annotator.model import SomeList, SomeDict, SomeChar
+            from rpython.annotator.model import SomeList, SomeDict, SomeChar,\
+                 SomeInteger
             for i, (expected_type, arg) in enumerate(zip(types, args)):
                 if expected_type is None:
                     continue
                 if isinstance(s_expected, SomeChar) and (
                         isinstance(arg, str) and len(arg) == 1):   # a char
                     continue
+                if (isinstance(s_expected, SomeInteger) and
+                    isinstance(arg, s_expected.knowntype)):
+                    continue
                 #
                 s_argtype = get_annotation(get_type_descr_of_argument(arg))
                 if not s_expected.contains(s_argtype):

File rpython/rtyper/lltypesystem/rdict.py

 
 @jit.look_inside_iff(lambda d, i: jit.isvirtual(d) and jit.isconstant(i))
 def _ll_dict_del(d, i):
+    assert i >= 0
     d.entries.mark_deleted(i)
     d.num_items -= 1
     # clear the key and the value if they are GC pointers
         i = r_uint(i)
         i = (i << 2) + i + perturb + 1
         i = intmask(i) & mask
+        assert i >= 0
         # keep 'i' as a signed number here, to consistently pass signed
         # arguments to the small helper methods.
         if not entries.everused(i):
     entries = d.entries
     mask = len(entries) - 1
     i = hash & mask
+    assert i >= 0
     perturb = r_uint(hash)
     while entries.everused(i):
         i = r_uint(i)
         i = (i << 2) + i + perturb + 1
         i = intmask(i) & mask
+        assert i >= 0
         perturb >>= PERTURB_SHIFT
     return i
 
         if dict:
             entries = dict.entries
             index = iter.index
+            assert index >= 0
             entries_len = len(entries)
             while index < entries_len:
                 entry = entries[index]