From: <nr...@us...> - 2008-07-09 03:50:22
|
Revision: 4881 http://jython.svn.sourceforge.net/jython/?rev=4881&view=rev Author: nriley Date: 2008-07-08 20:50:19 -0700 (Tue, 08 Jul 2008) Log Message: ----------- overriding fillInStackTrace for PyException speeds things up quite a bit Modified Paths: -------------- branches/asm/src/org/python/core/Options.java branches/asm/src/org/python/core/PyException.java Modified: branches/asm/src/org/python/core/Options.java =================================================================== --- branches/asm/src/org/python/core/Options.java 2008-07-09 00:42:59 UTC (rev 4880) +++ branches/asm/src/org/python/core/Options.java 2008-07-09 03:50:19 UTC (rev 4881) @@ -17,6 +17,13 @@ public static boolean showJavaExceptions = false; /** + * If true, exceptions raised from Python code will include a Java stack + * trace in addition to the Python traceback. This can slow raising + * considerably. + */ + public static boolean includeJavaStackInExceptions = false; + + /** * When true, python exception raised in overriden methods will be shown on * stderr. This option is remarkably useful when python is used for * implementing CORBA server. Some CORBA servers will turn python exception @@ -116,6 +123,9 @@ // Set the more unusual options Options.showJavaExceptions = getBooleanOption( "options.showJavaExceptions", Options.showJavaExceptions); + + Options.includeJavaStackInExceptions = getBooleanOption( + "options.includeJavaStackInExceptions", Options.includeJavaStackInExceptions); Options.showPythonProxyExceptions = getBooleanOption( "options.showPythonProxyExceptions", Modified: branches/asm/src/org/python/core/PyException.java =================================================================== --- branches/asm/src/org/python/core/PyException.java 2008-07-09 00:42:59 UTC (rev 4880) +++ branches/asm/src/org/python/core/PyException.java 2008-07-09 03:50:19 UTC (rev 4881) @@ -62,6 +62,13 @@ public void printStackTrace() { Py.printException(this); } + + public Throwable fillInStackTrace() { + if (Options.includeJavaStackInExceptions) + return super.fillInStackTrace(); + else + return this; + } public synchronized void printStackTrace(PrintStream s) { if (printingStackTrace) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |