[pypy-commit] pypy default: enforce those things to be unsigned
fijal
noreply at buildbot.pypy.org
Fri Feb 22 11:46:41 CET 2013
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r61593:0e57c3ef3cb4
Date: 2013-02-22 12:43 +0200
http://bitbucket.org/pypy/pypy/changeset/0e57c3ef3cb4/
Log: enforce those things to be unsigned
diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py
--- a/rpython/rlib/objectmodel.py
+++ b/rpython/rlib/objectmodel.py
@@ -153,7 +153,8 @@
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
@@ -167,6 +168,9 @@
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):
diff --git a/rpython/rtyper/lltypesystem/rdict.py b/rpython/rtyper/lltypesystem/rdict.py
--- a/rpython/rtyper/lltypesystem/rdict.py
+++ b/rpython/rtyper/lltypesystem/rdict.py
@@ -526,6 +526,7 @@
@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
@@ -617,6 +618,7 @@
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):
@@ -650,11 +652,13 @@
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
@@ -747,6 +751,7 @@
if dict:
entries = dict.entries
index = iter.index
+ assert index >= 0
entries_len = len(entries)
while index < entries_len:
entry = entries[index]
More information about the pypy-commit
mailing list