/** * Shut down the engine. * * <p> * We don't use m_interpreter.cleanup(), which delegates to * PySystemState.callExitFunc, as callExitFunc logs problems to stderr. * Instead we duplicate the callExitFunc behaviour raise our own exceptions. * </p> * * @throws EngineException * If the engine could not be shut down. */ @Override public void shutdown() throws EngineException { final PyObject exitfunc = m_systemState.__findattr__("exitfunc"); if (exitfunc != null) { try { exitfunc.__call__(); } catch (final PyException e) { throw new JythonScriptExecutionException( "calling script exit function", e); } } }
public void callExitFunc() throws PyIgnoreMethodTag { PyObject exitfunc = __findattr__("exitfunc"); if (exitfunc != null) { try { exitfunc.__call__(); } catch (PyException exc) { if (!exc.match(Py.SystemExit)) { Py.println(stderr, Py.newString("Error in sys.exitfunc:")); } Py.printException(exc); } } Py.flushLine(); }
ts.systemState.last_traceback = exc.traceback; PyObject exceptHook = ts.systemState.__findattr__("excepthook"); if (exceptHook != null) { try {