Issue1804011

classification
Title: classes extending dict can't be compared to dict
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: leosoto, pjenvey, tristan, tristanlk
Priority: normal Keywords:

Created on 2007-09-28.07:37:46 by tristanlk, last changed 2008-08-10.21:19:25 by leosoto.

Files
File name Uploaded Description Edit Remove
test_dict_extending.py tristanlk, 2007-09-28.07:37:47
Messages
msg1955 (view) Author: tristan (tristanlk) Date: 2007-09-28.07:37:46
if a class extends from dict, it cannot be compaired to a base dict. raises:
TypeError: dict.__cmp__(x,y) requires y to be 'dict', not a 'dict'

i've tried to come up with a patch, but haven't found a solution yet.
msg1956 (view) Author: tristan (tristanlk) Date: 2007-09-28.07:50:20
for django user's. here's a django fix to get around the instance where i got tripped up by this 
https://dev.archer.edu.au/projects/kepler/changeset/149?format=diff&new=149
msg1957 (view) Author: Philip Jenvey (pjenvey) Date: 2007-10-13.23:33:21
The patch for dict is probably going to be along the lines of changing

if (ob_other.getType() != getType())

to

if (ob_other instanceof PyDictionary)

(sorry for the lack of a diff)

Though your 'workaround' there seems to describe a problem with __cmp__ of lists. Is there a problem with list __cmp__ too?
msg1958 (view) Author: Leonardo Soto (leosoto) Date: 2007-10-16.12:56:39
Here is a simple test case for this bug: 

https://hg.leosoto.com/jython.hacks/raw-diff/6d07d809a2d3/jython/Lib/test/test_dict.py

[Posted as a link because I can't attach it to this bug report]
msg3329 (view) Author: Tristan King (tristan) Date: 2008-07-16.01:25:25
this seems to be fixed in 2.5a1+
msg3416 (view) Author: Leonardo Soto (leosoto) Date: 2008-08-10.21:19:25
Fixed on the asm branch. Test added on r5136.
History
Date User Action Args
2008-08-10 21:19:25leosotosetstatus: open -> closed
resolution: fixed
messages: + msg3416
2008-07-16 01:25:26tristansetnosy: + tristan
messages: + msg3329
2007-09-28 07:37:46tristanlkcreate