Martin v. Löwis wrote: > tanzer at swing.co.at 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 | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4