--- org/python/core/PyException.java 2004-08-18 13:30:27.000000000 -0500 +++ /home/deepak/ddroid/src/external/PyException.java 2004-08-18 13:27:19.000000000 -0500 @@ -16,15 +16,17 @@ * The python exception class (for class exception) or * identifier (for string exception). */ - public PyObject type; + transient public PyObject type; /** * The exception instance (for class exception) or exception * value (for string exception). */ - public PyObject value = Py.None; + transient public PyObject value = Py.None; + + transient public PyTraceback traceback; + public String stackTraceString = null; - public PyTraceback traceback; private boolean instantiated=false; public void instantiate() { @@ -68,6 +70,7 @@ if (frame != null && frame.tracefunc != null) { frame.tracefunc = frame.tracefunc.traceException(frame, this); } + this.stackTraceString = this.toString(); } public PyException(PyObject type, String value) { @@ -78,6 +81,7 @@ this.type = type; this.value = value; this.traceback = traceback; + this.stackTraceString = this.toString(); } private boolean printingStackTrace = false; @@ -92,7 +96,13 @@ } else { try { printingStackTrace = true; - Py.displayException(type, value, traceback, new PyFile(s)); + if ((type == null) || (value == null) || (traceback == null)) { + s.println(this.stackTraceString); + s.flush(); + } + else { + Py.displayException(type, value, traceback, new PyFile(s)); + } } finally { printingStackTrace = false; }