Author: Maciej Fijalkowski <fij...@gmail.com> Branch: Changeset: r75014:d19489819ae6 Date: 2014-12-18 14:49 +0200 http://bitbucket.org/pypy/pypy/changeset/d19489819ae6/
Log: merge 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 @@ -618,8 +618,8 @@ try: i = self.find(w_value, 0, sys.maxint) except ValueError: - raise OperationError(space.w_ValueError, - space.wrap("list.remove(x): x not in list")) + raise oefmt(space.w_ValueError, + "list.remove(): %R is not in list", w_value) if i < self.length(): # otherwise list was mutated self.pop(i) @@ -633,8 +633,7 @@ try: i = self.find(w_value, i, stop) except ValueError: - raise OperationError(space.w_ValueError, - space.wrap("list.index(x): x not in list")) + raise oefmt(space.w_ValueError, "%R is not in list", w_value) return space.wrap(i) @unwrap_spec(reverse=bool) 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 @@ -976,7 +976,10 @@ c = [0.0, 2.2, 4.4] assert c.index(0) == 0.0 - raises(ValueError, c.index, 3) + e = raises(ValueError, c.index, 3) + import sys + if sys.version_info[:2] == (2, 7): # CPython 2.7, PyPy + assert str(e.value) == '3 is not in list' def test_index_cpython_bug(self): if self.on_cpython: @@ -1228,7 +1231,9 @@ assert l == [0.0, 1.1, 3.3, 4.4] l = [0.0, 3.3, 5.5] raises(ValueError, c.remove, 2) - raises(ValueError, c.remove, 2.2) + e = raises(ValueError, c.remove, 2.2) + if not self.on_cpython: + assert str(e.value) == 'list.remove(): 2.2 is not in list' def test_reverse(self): c = list('hello world') _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit