From: <cg...@us...> - 2008-12-05 00:26:56
|
Revision: 5694 http://jython.svn.sourceforge.net/jython/?rev=5694&view=rev Author: cgroves Date: 2008-12-05 00:26:54 +0000 (Fri, 05 Dec 2008) Log Message: ----------- Expose __hash__ on Object. I'm amazed at the number of things that passed without this Modified Paths: -------------- branches/newstyle-java-types/src/org/python/core/PyJavaType.java Modified: branches/newstyle-java-types/src/org/python/core/PyJavaType.java =================================================================== --- branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-12-04 23:52:01 UTC (rev 5693) +++ branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-12-05 00:26:54 UTC (rev 5694) @@ -291,6 +291,13 @@ } }; dict.__setitem__("__eq__", new PyMethodDescr(this, equals)); + PyBuiltinCallable hash = new PyBuiltinMethodNarrow("__hash__", 0, 0) { + @Override + public PyObject __call__() { + return Py.newInteger(self.getJavaProxy().hashCode()); + } + }; + dict.__setitem__("__hash__", new PyMethodDescr(this, hash)); PyBuiltinCallable repr = new PyBuiltinMethodNarrow("__repr__", 0, 0) { @Override public PyObject __call__() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |