Author gvanrossum
Recipients amaury.forgeotdarc, eikeon, gvanrossum, jek, rhettinger
Date 2008-04-10.16:46:56
SpamBayes Score 0.00227043
Marked as misclassified No
Message-id <1207846017.65.0.637617137493.issue2235@psf.upfronthosting.co.za>
In-reply-to
Content
Hi Amaury, thanks for your work on this. I applied your patch and looked
at the code but there seem to be some issues left still.

(1) I don't think you need to add a warning to classic classes that
define __eq__ without __hash__ -- these aren't hashable and never were.
 The problem is purely with new classes AFAICT.

(2) I can't seen to trigger the warning for new classes (and yes, I
specified -3 on the command line :-):

>>> class C(object):
...   def __eq__(self, other): return False
...
>>> hash(C())
-134976284

(3) test_Hashable in test_collections.py fails.  This is because the
Hashable class believes that list, set, and dict are hashable. 
Something odd is going on:

>>> list.__hash__([])
-135100116

but

>>> hash([])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'

Note that in 2.5, both raise TypeError.
History
Date User Action Args
2008-04-10 16:46:58gvanrossumsetspambayes_score: 0.00227043 -> 0.00227043
recipients: + gvanrossum, rhettinger, amaury.forgeotdarc, jek, eikeon
2008-04-10 16:46:57gvanrossumsetspambayes_score: 0.00227043 -> 0.00227043
messageid: <1207846017.65.0.637617137493.issue2235@psf.upfronthosting.co.za>
2008-04-10 16:46:57gvanrossumlinkissue2235 messages
2008-04-10 16:46:56gvanrossumcreate