From: <cg...@us...> - 2008-12-01 01:14:25
|
Revision: 5669 http://jython.svn.sourceforge.net/jython/?rev=5669&view=rev Author: cgroves Date: 2008-12-01 01:14:21 +0000 (Mon, 01 Dec 2008) Log Message: ----------- Reset a PyJavaType's state when reload is called on it. This was just ignored on PyJavaClasses, so this is a little step up Modified Paths: -------------- branches/newstyle-java-types/src/org/python/core/PyObject.java branches/newstyle-java-types/src/org/python/core/__builtin__.java Modified: branches/newstyle-java-types/src/org/python/core/PyObject.java =================================================================== --- branches/newstyle-java-types/src/org/python/core/PyObject.java 2008-12-01 01:08:51 UTC (rev 5668) +++ branches/newstyle-java-types/src/org/python/core/PyObject.java 2008-12-01 01:14:21 UTC (rev 5669) @@ -618,7 +618,6 @@ * @param value the value to set this key to **/ public void __setitem__(PyObject key, PyObject value) { - Thread.dumpStack(); throw Py.TypeError(String.format("'%.200s' object does not support item assignment", getType().fastGetName())); } Modified: branches/newstyle-java-types/src/org/python/core/__builtin__.java =================================================================== --- branches/newstyle-java-types/src/org/python/core/__builtin__.java 2008-12-01 01:08:51 UTC (rev 5668) +++ branches/newstyle-java-types/src/org/python/core/__builtin__.java 2008-12-01 01:14:21 UTC (rev 5669) @@ -97,6 +97,8 @@ if (o == Py.NoConversion) { if (arg1 instanceof PySystemState) { return __builtin__.reload((PySystemState)arg1); + } else if(arg1 instanceof PyJavaType) { + return __builtin__.reload((PyJavaType)arg1); } throw Py.TypeError("reload() argument must be a module"); } @@ -1105,6 +1107,12 @@ return o; } + public static PyObject reload(PyJavaType o) { + // Reset the contents of our dict to the state from our class + o.init(); + return o; + } + public static PyString repr(PyObject o) { return o.__repr__(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |