Title: Bug in PyTuple.indexOf and PyList.indexOf
Type: behaviour Severity: normal
Components: Core Versions: 2.5.0
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: audetto, fwierzbicki, thobes
Priority: Keywords:

Created on 2009-07-31.19:37:21 by audetto, last changed 2009-09-09.17:36:28 by fwierzbicki.

msg4975 (view) Author: Andrea (audetto) Date: 2009-07-31.19:37:21
In both PyTuple and PyList there is a bug in indexOf since it does not
wrap the argument in a PyObject before calling indexOf in the underlying

On the other hand lastIndexOf in both works properly and the same should
be done for indexOf.


public synchronized int indexOf(Object o) {
     return list.indexOf(o);


public synchronized int lastIndexOf(Object o) {
     return list.lastIndexOf(Py.java2py(o));

What happens is that PyObject.equals(Object) is always false.
msg4982 (view) Author: Tobias Ivarsson (thobes) Date: 2009-08-04.01:02:18
Fix checked into rev6628:

Thanks to Andrea for Patch.

We should add a regression test for this.
msg5010 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-08-07.18:33:27
assigning to myself as a reminder to get a regression test for this.
msg5128 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-09-09.17:36:27
Added PyTupleTest and PyListTest to tests/java/ so this can be closed now.
Date User Action Args
2009-09-09 17:36:28fwierzbickisetstatus: open -> closed
resolution: fixed
messages: + msg5128
2009-08-07 18:33:27fwierzbickisetassignee: fwierzbicki
messages: + msg5010
nosy: + fwierzbicki
2009-08-04 01:02:18thobessetnosy: + thobes
messages: + msg4982
2009-07-31 19:37:21audettocreate