Nick Coghlan <[EMAIL PROTECTED]> added the comment:

Attached patch allows classes to explicitly block inheritance of
object.__hash__ by setting the tp_hash slot to Py_None or the __hash__
attribute to None.

This is similar to the approach used in Py3k, but allows __hash__ to be
inherited by default, with classes explicitly disabling it as
appropriate. I'd also suggest forward porting this approach to Py3k as
well, and then possibly look at replacing a copied tp_hash slot with
Py_None when the inherited tp_hash is object.tp_hash, but tp_cmp or
tp_richcompare are different.

Added file: http://bugs.python.org/file10773/issue2235_fix_hash_inheritance.diff

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2235>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to