Author: Maciej Fijalkowski <fij...@gmail.com> Branch: Changeset: r57399:71931876cb9c Date: 2012-09-20 11:00 +0200 http://bitbucket.org/pypy/pypy/changeset/71931876cb9c/
Log: merge diff --git a/pypy/doc/jit/pyjitpl5.rst b/pypy/doc/jit/pyjitpl5.rst --- a/pypy/doc/jit/pyjitpl5.rst +++ b/pypy/doc/jit/pyjitpl5.rst @@ -149,7 +149,7 @@ A *virtual* value is an array, struct, or RPython level instance that is created during the loop and does not escape from it via calls or longevity past the -loop. Since it is only used by the JIT, it be "optimized out"; the value +loop. Since it is only used by the JIT, it can be "optimized out"; the value doesn't have to be allocated at all and its fields can be stored as first class values instead of deferencing them in memory. Virtuals allow temporary objects in the interpreter to be unwrapped. For example, a W_IntObject in the PyPy can 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 @@ -589,12 +589,14 @@ def append(self, w_list, w_item): if is_W_IntObject(w_item): l = self.unerase(w_list.lstorage) - step = l[1] - last_in_range = self._getitem_unwrapped(w_list, -1) - if self.unwrap(w_item) - step == last_in_range: - new = self.erase((l[0], l[1], l[2] + 1)) - w_list.lstorage = new - return + length = l[2] + if length: + last_in_range = self._getitem_unwrapped(w_list, -1) + step = l[1] + if self.unwrap(w_item) - step == last_in_range: + new = self.erase((l[0], step, length + 1)) + w_list.lstorage = new + return self.switch_to_integer_strategy(w_list) else: diff --git a/pypy/objspace/std/test/test_listobject.py b/pypy/objspace/std/test/test_listobject.py --- a/pypy/objspace/std/test/test_listobject.py +++ b/pypy/objspace/std/test/test_listobject.py @@ -1345,6 +1345,13 @@ l.reverse() assert l == [2,1,0] + def test_issue1266(self): + l = range(1) + l.pop() + # would previously crash + l.append(1) + assert l == [1] + class AppTestWithoutStrategies(object): def setup_class(cls): _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit