[issue2235] __eq__ / __hash__ check doesn't take inheritance into account

Nick Coghlan report at bugs.python.org
Fri Jun 27 15:23:20 CEST 2008


Nick Coghlan <ncoghlan at gmail.com> added the comment:

Amaury's patch doesn't currently remove the new-in-2.6 code that turns
"tp_hash = NULL" at the C level into "__hash__ = None" at the Python
level. I suspect that will prove to be a problem (and may be the cause
of Django's woes, if I remember Glyph's python-dev posts correctly). I
also don't believe the new TPSLOT entries should be necessary - we
should be able to just revert all of this tp_hash related code to match
the 2.5 implementation, and then see if we can find a way to emit the
Py3k warning when __cmp__ or __eq__ are overridden without overriding
__hash__ without breaking any existing code (if we can't, we may have to
figure out a way to get 2to3 to check for it).

P.S. you'd think I would have learnt by now not to try to make sense of
typeobject.c when I'm tired ;)

----------
nosy: +ncoghlan

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2235>
_______________________________________


More information about the Python-bugs-list mailing list