I've posted a possible fix for the __hash__ backwards incompatibilities
described in issue 2235 [1].
The patch uses a model similar to that used in Py3k (using None is
indicate "don't inherit __hash__"), but extends it to allowing Py_None
to be explicitly stored in the tp_hash slot. The major downside is that
we suffer the cost of an extra pointer comparison on every call to
PyObject_Hash, but I wasn't able to come up with another solution that
preserved backwards compatibility while still allowing
collections.Hashable to function correctly.
The patch involves a few changes to fairly deep components in
typeobject.c though, so I'd like at least some kind of sanity check
before I commit it.
Cheers,
Nick.
[1] http://bugs.python.org/issue2235
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com