[pypy-svn] r22827 - pypy/dist/pypy/rpython
arigo at codespeak.net
arigo at codespeak.net
Sun Jan 29 12:49:07 CET 2006
Author: arigo
Date: Sun Jan 29 12:49:06 2006
New Revision: 22827
Modified:
pypy/dist/pypy/rpython/rlist.py
Log:
Stick the type of the list item on the LIST GcStruct definition.
This gives a generic way to write 'LIST.ITEM' that works for both
fixed and non-fixed kinds of lists.
Modified: pypy/dist/pypy/rpython/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/rlist.py (original)
+++ pypy/dist/pypy/rpython/rlist.py Sun Jan 29 12:49:06 2006
@@ -210,6 +210,7 @@
"ll_length": ll_length,
"ll_items": ll_items,
"list_builder": self.list_builder.build,
+ "ITEM": ITEM,
})
)
@@ -283,6 +284,7 @@
"ll_length": ll_fixed_length,
"ll_items": ll_fixed_items,
"list_builder": self.list_builder.build,
+ "ITEM": ITEM,
})
self.LIST.become(ITEMARRAY)
@@ -487,7 +489,7 @@
p = new_allocated - 1
while p >= 0:
newitems[p] = items[p]
- ITEM = typeOf(l).TO.items.TO.OF
+ ITEM = typeOf(l).TO.ITEM
if isinstance(ITEM, Ptr):
items[p] = nullptr(ITEM.TO)
p -= 1
@@ -591,7 +593,7 @@
newlength = index
items = l.items
res = items[index]
- ITEM = typeOf(l).TO.items.TO.OF
+ ITEM = typeOf(l).TO.ITEM
if isinstance(ITEM, Ptr):
items[index] = nullptr(ITEM.TO)
_ll_list_resize_le(l, newlength)
@@ -611,7 +613,7 @@
items[j] = items[j1]
j = j1
j1 += 1
- ITEM = typeOf(l).TO.items.TO.OF
+ ITEM = typeOf(l).TO.ITEM
if isinstance(ITEM, Ptr):
items[newlength] = nullptr(ITEM.TO)
_ll_list_resize_le(l, newlength)
@@ -684,7 +686,7 @@
items[j] = items[j1]
j = j1
j1 += 1
- ITEM = typeOf(l).TO.items.TO.OF
+ ITEM = typeOf(l).TO.ITEM
if isinstance(ITEM, Ptr):
items[newlength] = nullptr(ITEM.TO)
_ll_list_resize_le(l, newlength)
@@ -779,7 +781,7 @@
def ll_listdelslice_startonly(l, start):
newlength = start
- ITEM = typeOf(l).TO.items.TO.OF
+ ITEM = typeOf(l).TO.ITEM
if isinstance(ITEM, Ptr):
j = l.length - 1
items = l.items
@@ -801,7 +803,7 @@
items[j] = items[i]
i += 1
j += 1
- ITEM = typeOf(l).TO.items.TO.OF
+ ITEM = typeOf(l).TO.ITEM
if isinstance(ITEM, Ptr):
j = l.length - 1
while j >= newlength:
More information about the Pypy-commit
mailing list