From: <pj...@us...> - 2008-10-12 22:18:20
|
Revision: 5381 http://jython.svn.sourceforge.net/jython/?rev=5381&view=rev Author: pjenvey Date: 2008-10-12 22:18:06 +0000 (Sun, 12 Oct 2008) Log Message: ----------- better unhashable TypeError messages Modified Paths: -------------- trunk/jython/src/org/python/core/PyDictionary.java trunk/jython/src/org/python/core/PyList.java trunk/jython/src/org/python/core/PySlice.java trunk/jython/src/templates/object.derived Modified: trunk/jython/src/org/python/core/PyDictionary.java =================================================================== --- trunk/jython/src/org/python/core/PyDictionary.java 2008-10-12 20:10:04 UTC (rev 5380) +++ trunk/jython/src/org/python/core/PyDictionary.java 2008-10-12 22:18:06 UTC (rev 5381) @@ -661,7 +661,7 @@ @ExposedMethod final int dict___hash__() { - throw Py.TypeError("unhashable type"); + throw Py.TypeError(String.format("unhashable type: '%.200s'", getType().fastGetName())); } public boolean isSequenceType() { Modified: trunk/jython/src/org/python/core/PyList.java =================================================================== --- trunk/jython/src/org/python/core/PyList.java 2008-10-12 20:10:04 UTC (rev 5380) +++ trunk/jython/src/org/python/core/PyList.java 2008-10-12 22:18:06 UTC (rev 5381) @@ -730,7 +730,7 @@ @ExposedMethod final int list___hash__() { - throw Py.TypeError("unhashable type"); + throw Py.TypeError(String.format("unhashable type: '%.200s'", getType().fastGetName())); } public PyTuple __getnewargs__() { Modified: trunk/jython/src/org/python/core/PySlice.java =================================================================== --- trunk/jython/src/org/python/core/PySlice.java 2008-10-12 20:10:04 UTC (rev 5380) +++ trunk/jython/src/org/python/core/PySlice.java 2008-10-12 22:18:06 UTC (rev 5381) @@ -71,7 +71,7 @@ @ExposedMethod final int slice___hash__() { - throw Py.TypeError("unhashable type"); + throw Py.TypeError(String.format("unhashable type: '%.200s'", getType().fastGetName())); } public PyString __str__() { Modified: trunk/jython/src/templates/object.derived =================================================================== --- trunk/jython/src/templates/object.derived 2008-10-12 20:10:04 UTC (rev 5380) +++ trunk/jython/src/templates/object.derived 2008-10-12 22:18:06 UTC (rev 5381) @@ -78,7 +78,7 @@ throw Py.TypeError("__hash__ should return a int"); } if (self_type.lookup("__eq__") != null || self_type.lookup("__cmp__") != null) { - throw Py.TypeError("unhashable type"); + throw Py.TypeError(String.format("unhashable type: '%.200s'", getType().fastGetName())); } return super.hashCode(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |