From: <pj...@us...> - 2008-08-01 21:49:32
|
Revision: 5046 http://jython.svn.sourceforge.net/jython/?rev=5046&view=rev Author: pjenvey Date: 2008-08-01 21:49:29 +0000 (Fri, 01 Aug 2008) Log Message: ----------- fix instancemethod cmp to make test_class pass Modified Paths: -------------- branches/asm/Lib/test/regrtest.py branches/asm/Lib/test/test_class.py branches/asm/src/org/python/core/PyMethod.java Modified: branches/asm/Lib/test/regrtest.py =================================================================== --- branches/asm/Lib/test/regrtest.py 2008-08-01 21:47:30 UTC (rev 5045) +++ branches/asm/Lib/test/regrtest.py 2008-08-01 21:49:29 UTC (rev 5046) @@ -1469,7 +1469,6 @@ 'java': """ test_ast - test_class test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp Modified: branches/asm/Lib/test/test_class.py =================================================================== --- branches/asm/Lib/test/test_class.py 2008-08-01 21:47:30 UTC (rev 5045) +++ branches/asm/Lib/test/test_class.py 2008-08-01 21:49:29 UTC (rev 5046) @@ -250,8 +250,8 @@ del testme if sys.platform[:4] == 'java': - import java - java.lang.System.gc() + from test_weakref import extra_collect + extra_collect() # Interfering tests Modified: branches/asm/src/org/python/core/PyMethod.java =================================================================== --- branches/asm/src/org/python/core/PyMethod.java 2008-08-01 21:47:30 UTC (rev 5045) +++ branches/asm/src/org/python/core/PyMethod.java 2008-08-01 21:49:29 UTC (rev 5046) @@ -127,16 +127,20 @@ if (!(other instanceof PyMethod)) { return -2; } - PyMethod mother = (PyMethod)other; - if (im_self != mother.im_self) { - return System.identityHashCode(im_self) < - System.identityHashCode(mother.im_self) ? -1 : 1; + PyMethod otherMethod = (PyMethod)other; + int cmp = im_func._cmp(otherMethod.im_func); + if (cmp != 0) { + return cmp; } - if (im_func != mother.im_func) { - return System.identityHashCode(im_func) < - System.identityHashCode(mother.im_func) ? -1 : 1; + if (im_self == otherMethod.im_self) { + return 0; } - return 0; + if (im_self == null || otherMethod.im_self == null) { + return System.identityHashCode(im_self) < System.identityHashCode(otherMethod.im_self) + ? -1 : 1; + } else { + return im_self._cmp(otherMethod.im_self); + } } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |