Issue515497
Created on 2002-02-10.12:32:08 by dirk28, last changed 2008-06-08.04:26:14 by pjenvey.
msg569 (view) |
Author: Dirk Stockmann (dirk28) |
Date: 2002-02-10.12:32:08 |
|
Hello,
I have noticed a strange behavior of Jython.
Consider the following program:
class c:
def m(self):
pass
i = c()
d = {}
d[i.m] = 42
d[i.m] = 23
print d
Result for CPython 2.1.1:
dirk@susi:~/python> python test.py
{<method c.m of c instance at 0x80e6394>: 23}
With Jython 2.1 and Sun Java2 1.4rc1 however:
dirk@susi:~/python> ../jython-2.1/jython test.py
{<method c.m of c instance at 16348303>: 23, <method
c.m of c instance at 16348303>: 42}
It seems that method instances are no longer unique,
once entered as key into a dictionary.
Cheers,
Dirk
|
msg570 (view) |
Author: Deleted User leouserz (leouserz) |
Date: 2006-12-22.01:27:14 |
|
this can be seen as caused by 1 of 2 things:
1. hashCode is returning System.identityHashCode
2. PyMethod when it creates a new bound PyMethod is not caching per im_self instance.
Fixing either one of these will result in the problem going away.
leouser
|
msg3249 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2008-06-08.04:26:03 |
|
fixed in r4566 by giving method a custom hashCode. builtin methods also
required this fix
thanks all
|
|
Date |
User |
Action |
Args |
2008-06-08 04:26:15 | pjenvey | set | status: open -> closed resolution: fixed messages:
+ msg3249 nosy:
+ pjenvey |
2002-02-10 12:32:08 | dirk28 | create | |
|