From: Finn B. <bc...@us...> - 2001-08-05 15:14:10
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv24423 Modified Files: PyList.java Log Message: Changed the exception message from remove() and index() so it matches CPython. Only to make test_doctest happy. Index: PyList.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyList.java,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -d -r2.21 -r2.22 *** PyList.java 2001/03/04 18:08:59 2.21 --- PyList.java 2001/08/05 15:14:07 2.22 *************** *** 353,356 **** --- 353,360 ---- */ public int index(PyObject o) { + return _index(o, "list.index(x): x not in list"); + } + + private int _index(PyObject o, String message) { int n = length; PyObject[] list = this.list; *************** *** 361,365 **** } if (i == n) ! throw Py.ValueError("item not found in list"); return i; } --- 365,369 ---- } if (i == n) ! throw Py.ValueError(message); return i; } *************** *** 393,397 **** */ public void remove(PyObject o) { ! del(index(o)); } --- 397,401 ---- */ public void remove(PyObject o) { ! del(_index(o, "list.remove(x): x not in list")); } |