Title: list.count considers tuples and lists to be equal
Type: Severity: normal
Components: Core Versions: 2.5b1
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: fwierzbicki, yanne, zyasoft
Priority: high Keywords:

Created on 2009-04-16.11:00:43 by yanne, last changed 2009-04-21.02:37:39 by zyasoft.

msg4519 (view) Author: Janne Härkönen (yanne) Date: 2009-04-16.11:00:42
ython 2.2 on java1.6.0_10
Type "copyright", "credits" or "license" for more information.
>>> [ (1,), [1] ].count([1])

Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> [ (1,), [1] ].count([1])
msg4557 (view) Author: Jim Baker (zyasoft) Date: 2009-04-20.15:48:41
This example causes PyList#equals to stack overflow in trunk. But it 
should be a simple fix.

For 2.2, we would need to distinguish between PyList and PyTuple, 
instead of just doing equality on PySequenceList.
msg4559 (view) Author: Jim Baker (zyasoft) Date: 2009-04-21.02:37:39
Fixed as of r6248

The actual fix needed is in PyTuple#equals. The complexity arises in
that we allow java.util.List objs to compare to python tuples, but
Python semantics means this shouldn't apply to PyList (even though they
implement the List interface).
Date User Action Args
2009-04-21 02:37:39zyasoftsetstatus: open -> closed
resolution: fixed
messages: + msg4559
2009-04-20 15:48:42zyasoftsetversions: + 2.5b1
nosy: + fwierzbicki, zyasoft
messages: + msg4557
priority: high
assignee: zyasoft
components: + Core
2009-04-16 11:00:43yannecreate