[pypy-dev] rlist and ll_delitem_nonneg index

Zariko Taba zariko.taba at gmail.com
Fri Sep 23 14:37:12 CEST 2011

Hi pypy !

I hit an assert in pypy/annotation/annrpython.py in addpendingblock line 231
: assert annmodel.unionof(s_oldarg, s_newarg) == s_oldarg

I think I found an explanation by digging in code :

The treated block is in the "ll_delitem_nonneg" function,
s_newarg is a "SomeInteger(nonneg=True)" and s_oldarg is a
and in fact they are the "index" argument of this function.

oldarg comes from a previous annotation using the "rtype_method_remove" of
"rtype_method_remove" use "ll_listremove" which use :
ll_delitem_nonneg(..., ll_listindex(...))
Looking at ll_listindex, it seems clear that the index can be proved as
always positive.
That's probably why s_oldarg is a "SomeInteger(nonneg=True)"

The new annotation comes from the method "rtype_delitem" (class __extend__
in rlist.py).
the index from hop is always positive, so the code :
if hop.args_s[1].nonneg:
    llfn = ll_delitem_nonneg
select "ll_delitem_nonneg" as the deletion function.
But the index given to the annotator is taken from :
v_lst, v_index = hop.inputargs(r_lst, Signed)
v_index is a "Signed"
The information concerning the "non negative" property of the index integer
is lost here.
index is now "SomeInteger(nonneg=False)" and trigs the assert.

What do you think ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20110923/9d7aac26/attachment.html>

More information about the pypy-dev mailing list