@@ -56,14 +56,14 @@ def test_rlist_set(self):
56
56
def test_rlist_slice (self ):
57
57
l = self .sample_list ()
58
58
LIST = typeOf (l ).TO
59
- self .check_list (ll_listslice_startonly (LIST , l , 0 ), [42 , 43 , 44 , 45 ])
60
- self .check_list (ll_listslice_startonly (LIST , l , 1 ), [43 , 44 , 45 ])
61
- self .check_list (ll_listslice_startonly (LIST , l , 2 ), [44 , 45 ])
62
- self .check_list (ll_listslice_startonly (LIST , l , 3 ), [45 ])
63
- self .check_list (ll_listslice_startonly (LIST , l , 4 ), [])
59
+ self .check_list (ll_listslice_startonly_unsafe (LIST , l , 0 ), [42 , 43 , 44 , 45 ])
60
+ self .check_list (ll_listslice_startonly_unsafe (LIST , l , 1 ), [43 , 44 , 45 ])
61
+ self .check_list (ll_listslice_startonly_unsafe (LIST , l , 2 ), [44 , 45 ])
62
+ self .check_list (ll_listslice_startonly_unsafe (LIST , l , 3 ), [45 ])
63
+ self .check_list (ll_listslice_startonly_unsafe (LIST , l , 4 ), [])
64
64
for start in range (5 ):
65
65
for stop in range (start , 8 ):
66
- self .check_list (ll_listslice_startstop (LIST , l , start , stop ),
66
+ self .check_list (ll_listslice_startstop_unsafe (LIST , l , start , stop ),
67
67
[42 , 43 , 44 , 45 ][start :stop ])
68
68
69
69
def test_rlist_setslice (self ):
@@ -77,7 +77,7 @@ def test_rlist_setslice(self):
77
77
expected [i ] = n
78
78
ll_setitem_unsafe (l2 , i , n )
79
79
n += 1
80
- l2 = ll_listslice_startstop (typeOf (l2 ).TO , l2 , start , stop )
80
+ l2 = ll_listslice_startstop_unsafe (typeOf (l2 ).TO , l2 , start , stop )
81
81
ll_listsetslice (l1 , start , stop , l2 )
82
82
self .check_list (l1 , expected )
83
83
@@ -99,7 +99,7 @@ def sample_list(self): # [42, 43, 44, 45]
99
99
ll_setitem_unsafe (l , 0 , 42 )
100
100
ll_setitem_unsafe (l , - 2 , 43 )
101
101
ll_setitem_nonneg_unsafe (l , 2 , 44 )
102
- ll_append (l , 45 )
102
+ ll_append_unsafe (l , 45 )
103
103
return l
104
104
105
105
def test_rlist_del (self ):
@@ -124,14 +124,14 @@ def test_rlist_extend_concat(self):
124
124
125
125
def test_rlist_delslice (self ):
126
126
l = self .sample_list ()
127
- ll_listdelslice_startonly (l , 3 )
127
+ ll_listdelslice_startonly_unsafe (l , 3 )
128
128
self .check_list (l , [42 , 43 , 44 ])
129
- ll_listdelslice_startonly (l , 0 )
129
+ ll_listdelslice_startonly_unsafe (l , 0 )
130
130
self .check_list (l , [])
131
131
for start in range (5 ):
132
132
for stop in range (start , 8 ):
133
133
l = self .sample_list ()
134
- ll_listdelslice_startstop (l , start , stop )
134
+ ll_listdelslice_startstop_unsafe (l , start , stop )
135
135
expected = [42 , 43 , 44 , 45 ]
136
136
del expected [start :stop ]
137
137
self .check_list (l , expected )
@@ -1613,17 +1613,16 @@ def dummyfn():
1613
1613
total += ord (c )
1614
1614
return total
1615
1615
#
1616
- prev = rlist .ll_getitem_foldable_nonneg
1616
+ prev = rlist .ll_getitem_foldable_nonneg_unsafe
1617
1617
try :
1618
1618
def seen_ok (l , index ):
1619
1619
if index == 5 :
1620
1620
raise KeyError # expected case
1621
1621
return prev (l , index )
1622
- rlist .ll_getitem_foldable_nonneg = seen_ok
1623
- e = py .test .raises (LLException , self .interpret , dummyfn , [])
1624
- assert 'KeyError' in str (e .value )
1622
+ rlist .ll_getitem_foldable_nonneg_unsafe = seen_ok
1623
+ self .interpret (dummyfn , [])
1625
1624
finally :
1626
- rlist .ll_getitem_foldable_nonneg = prev
1625
+ rlist .ll_getitem_foldable_nonneg_unsafe = prev
1627
1626
1628
1627
def test_iterate_over_immutable_list_quasiimmut_attr (self ):
1629
1628
from rpython .rtyper import rlist
@@ -1639,17 +1638,16 @@ def dummyfn():
1639
1638
total += ord (c )
1640
1639
return total
1641
1640
#
1642
- prev = rlist .ll_getitem_foldable_nonneg
1641
+ prev = rlist .ll_getitem_foldable_nonneg_unsafe
1643
1642
try :
1644
1643
def seen_ok (l , index ):
1645
1644
if index == 5 :
1646
1645
raise KeyError # expected case
1647
1646
return prev (l , index )
1648
- rlist .ll_getitem_foldable_nonneg = seen_ok
1649
- e = py .test .raises (LLException , self .interpret , dummyfn , [])
1650
- assert 'KeyError' in str (e .value )
1647
+ rlist .ll_getitem_foldable_nonneg_unsafe = seen_ok
1648
+ self .interpret (dummyfn , [])
1651
1649
finally :
1652
- rlist .ll_getitem_foldable_nonneg = prev
1650
+ rlist .ll_getitem_foldable_nonneg_unsafe = prev
1653
1651
1654
1652
def test_iterate_over_mutable_list (self ):
1655
1653
from rpython .rtyper import rlist
@@ -1663,17 +1661,17 @@ def dummyfn():
1663
1661
lst [0 ] = 'x'
1664
1662
return total
1665
1663
#
1666
- prev = rlist .ll_getitem_foldable_nonneg
1664
+ prev = rlist .ll_getitem_foldable_nonneg_unsafe
1667
1665
try :
1668
1666
def seen_ok (l , index ):
1669
1667
if index == 5 :
1670
1668
raise KeyError # expected case
1671
1669
return prev (l , index )
1672
- rlist .ll_getitem_foldable_nonneg = seen_ok
1670
+ rlist .ll_getitem_foldable_nonneg_unsafe = seen_ok
1673
1671
res = self .interpret (dummyfn , [])
1674
1672
assert res == sum (map (ord , 'abcdef' ))
1675
1673
finally :
1676
- rlist .ll_getitem_foldable_nonneg = prev
1674
+ rlist .ll_getitem_foldable_nonneg_unsafe = prev
1677
1675
1678
1676
def test_extend_was_not_overallocating (self ):
1679
1677
from rpython .rlib import rgc
0 commit comments