Author: Squeaky <squeaky...@gmx.com>
Branch: simple-range-strategy
Changeset: r69674:b80212121437
Date: 2014-03-04 11:28 +0100
http://bitbucket.org/pypy/pypy/changeset/b80212121437/

Log:    some asserts for annotator

diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -43,8 +43,9 @@
     if length <= 0:
         strategy = space.fromcache(EmptyListStrategy)
         storage = strategy.erase(None)
-    elif start == 0 and step == 1 and length <= 2 ** 31 - 1:
+    elif start == 0 and step == 1:
         strategy = space.fromcache(SimpleRangeListStrategy)
+        assert length > 0
         storage = strategy.erase((length,))
     else:
         strategy = space.fromcache(RangeListStrategy)
@@ -1146,11 +1147,11 @@
     def pop_end(self, w_list):
         length_m1 = self.unerase(w_list.lstorage)[0] - 1
         w_result = self.wrap(length_m1)
+        assert length_m1 > 0
         w_list.lstorage = self.erase((length_m1,))
         return w_result
 
     def pop(self, w_list, index):
-        # XXX could be promoted to RangeListStrategy
         self.switch_to_integer_strategy(w_list)
         return w_list.pop(index)
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to