"Neal Norwitz" <[EMAIL PROTECTED]> wrote: > Things are getting better, but we still have some really important > outstanding issues. PLEASE CONTINUE TESTING AS MUCH AS POSSIBLE.
I've run into a problem with a big application that I wasn't able to reproduce with a small example. I've submitted a bug report to Sourceforge (Id 1536021)*. As Sourceforge seems to mangle the code I used to describe the problem, I'll include it here once more: The code (exception handler added to demonstrate and work around the problem): try : h = hash(p) except OverflowError, e: print type(p), p, id(p), e h = id(p) & 0x0FFFFFFF prints the following output: <type 'instancemethod'> <bound method Script_Category.is_applicable of <Script_Menu_Mgr.Script_Category object at 0xb6cb4f8c>> 3066797028 long int too large to convert to int This happens with Python 2.5b3, but didn't happen with Python 2.4.3. I assume that the hash-function for function/methods returns the `id` of the function. The following code demonstrates the same problem with a Python class whose `__hash__` returns the `id` of the object: $ python2.4 Python 2.4.3 (#1, Jun 30 2006, 10:02:59) [GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> class X(object): ... def __hash__(self): return id(self) ... >>> hash (X()) -1211078036 $ python2.5 Python 2.5b3 (r25b3:51041, Aug 7 2006, 15:35:35) [GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 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 (*) http://sourceforge.net/tracker/index.php?func=detail&aid=1536021&group_id=5470&atid=105470 -- Christian Tanzer http://www.c-tanzer.at/ _______________________________________________ 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