[pypy-commit] pypy simple-range-strategy: fix test

squeaky noreply at buildbot.pypy.org
Tue Mar 4 18:52:27 CET 2014


Author: Squeaky <squeaky_pl at gmx.com>
Branch: simple-range-strategy
Changeset: r69679:97595f9d3e7f
Date: 2014-03-04 17:26 +0100
http://bitbucket.org/pypy/pypy/changeset/97595f9d3e7f/

Log:	fix test

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
@@ -1154,10 +1154,13 @@
             func_with_new_name(_getitems_range, "_getitems_range_unroll"))
 
     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,))
+        new_length = self.unerase(w_list.lstorage)[0] - 1
+        w_result = self.wrap(new_length)
+        if new_length > 0:
+            w_list.lstorage = self.erase((new_length,))
+        else:
+            strategy = w_list.strategy = self.space.fromcache(EmptyListStrategy)
+            w_list.lstorage = strategy.erase(None)
         return w_result
 
     def pop(self, w_list, index):


More information about the pypy-commit mailing list