Martin v. Löwis wrote:
> [EMAIL PROTECTED] schrieb:
>> >>> class X(object):
>> ... def __hash__(self): return id(self)
>> ...
>> >>> hash (X())
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> OverflowError: long int too large to convert to int
>
> Yes, this comes from id() now always returning positive integers,
> which might be a long if the object pointer is > MAXINT
>
> I think both instance_hash and slot_tp_hash should be changed
> to just truncate long ints to the range LONG_MIN..LONG_MAX
Couldn't they be changed to invoke long's own hash method when a long object
is returned from __hash__?
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com