Author therve
Recipients therve
Date 2007-12-03.13:51:30
SpamBayes Score 0.0608274
Marked as misclassified No
Message-id <1196689891.72.0.237226656542.issue1549@psf.upfronthosting.co.za>
In-reply-to
Content
A new behavior was introduced in r59106 in python trunk, which look
suspicious to me. Basically, every time a class defines a comparison
operator, it's __hash__ method is defined to None. The simple following
example shows it:

>>> class A(object):
...     def __init__(self, b):
...             self.b = b
...     def __cmp__(self, other):
...             if not isinstance(other, A):
...                     return -1
...             return cmp(self.b, other.b)
...
>>> hash(A(2))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable


The problematic change is here:
http://svn.python.org/view/python/trunk/Objects/typeobject.c?rev=59106&r1=58032&r2=59106

And mainly the overrides_hash call in inherit_slots.

FWIW, I've encounter the problem because zope.interface is now usable on
trunk.
History
Date User Action Args
2007-12-03 13:51:31thervesetspambayes_score: 0.0608274 -> 0.0608274
recipients: + therve
2007-12-03 13:51:31thervesetspambayes_score: 0.0608274 -> 0.0608274
messageid: <1196689891.72.0.237226656542.issue1549@psf.upfronthosting.co.za>
2007-12-03 13:51:31thervelinkissue1549 messages
2007-12-03 13:51:30thervecreate