From: Finn B. <bc...@us...> - 2001-11-28 19:25:35
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv15808 Modified Files: Py.java PyException.java PySystemState.java Log Message: Add a file argument to Py.displayException() and use that from PyException.toString(). Index: Py.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Py.java,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -d -r2.58 -r2.59 *** Py.java 2001/11/27 19:07:21 2.58 --- Py.java 2001/11/28 19:25:33 2.59 *************** *** 913,924 **** } catch (PyException exc2) { stderr.println("Error in sys.excepthook:"); ! displayException(exc2.type, exc2.value, exc2.traceback); stderr.println(); stderr.println("Original exception was:"); ! displayException(exc.type, exc.value, exc.traceback); } } else { stderr.println("sys.excepthook is missing"); ! displayException(exc.type, exc.value, exc.traceback); } --- 913,924 ---- } catch (PyException exc2) { stderr.println("Error in sys.excepthook:"); ! displayException(exc2.type, exc2.value, exc2.traceback, file); stderr.println(); stderr.println("Original exception was:"); ! displayException(exc.type, exc.value, exc.traceback, file); } } else { stderr.println("sys.excepthook is missing"); ! displayException(exc.type, exc.value, exc.traceback, file); } *************** *** 927,932 **** public static void displayException(PyObject type, PyObject value, ! PyObject tb) { if (tb instanceof PyTraceback) stderr.print(((PyTraceback) tb).dumpStack()); --- 927,937 ---- public static void displayException(PyObject type, PyObject value, ! PyObject tb, PyObject file) { + StdoutWrapper stderr = Py.stderr; + if (file != null) { + stderr = new FixedFileWrapper(file); + } + if (tb instanceof PyTraceback) stderr.print(((PyTraceback) tb).dumpStack()); Index: PyException.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyException.java,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -d -r2.6 -r2.7 *** PyException.java 2001/10/28 17:13:43 2.6 --- PyException.java 2001/11/28 19:25:33 2.7 *************** *** 93,97 **** try { printingStackTrace = true; ! Py.printException(this, null, new PyFile(s)); } finally { printingStackTrace = false; --- 93,97 ---- try { printingStackTrace = true; ! Py.displayException(type, value, traceback, new PyFile(s)); } finally { printingStackTrace = false; Index: PySystemState.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PySystemState.java,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -d -r2.68 -r2.69 *** PySystemState.java 2001/11/27 19:07:21 2.68 --- PySystemState.java 2001/11/28 19:25:33 2.69 *************** *** 635,639 **** static void excepthook(PyObject type, PyObject val, PyObject tb) { ! Py.displayException(type, val, tb); } --- 635,639 ---- static void excepthook(PyObject type, PyObject val, PyObject tb) { ! Py.displayException(type, val, tb, null); } |